Wire up de-DE and pl-PL translations
[cygwin-setup.git] / Exception.h
blobe4abd18b86de61470fcccc32e03c56493bdaffbe
1 /*
2 * Copyright (c) 2001, Robert Collins.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 #ifndef SETUP_EXCEPTION_H
17 #define SETUP_EXCEPTION_H
19 #include <exception>
20 #include <string>
21 #include <typeinfo>
22 #include "msg.h"
24 class Exception : public std::exception {
25 public:
26 Exception (char const *where, char const *message, int appErrNo = 0);
27 Exception (char const *where, const std::string& message, int appErrNo = 0);
28 ~Exception () throw() {};
29 char const *what() const throw();
30 int errNo() const;
31 private:
32 std::string _message;
33 int appErrNo;
36 #define APPERR_CORRUPT_PACKAGE 1
37 #define APPERR_IO_ERROR 2
38 #define APPERR_LOGIC_ERROR 3
39 #define APPERR_WINDOW_ERROR 4
41 #define TOPLEVEL_CATCH(owner, threadname) \
42 catch (Exception *e) \
43 { \
44 fatal((owner), IDS_UNCAUGHT_EXCEPTION_WITH_ERRNO, (threadname), \
45 typeid(*e).name(), e->what(), e->errNo()); \
46 } \
47 catch (std::exception *e) \
48 { \
49 fatal((owner), IDS_UNCAUGHT_EXCEPTION, (threadname), \
50 typeid(*e).name(), e->what()); \
54 #endif /* SETUP_EXCEPTION_H */