]> cygwin.com Git - cygwin-apps/setup.git/blob - Exception.h
Fix build when CRYPTODEBUGGING is defined
[cygwin-apps/setup.git] / Exception.h
1 /*
2 * Copyright (c) 2001, Robert Collins.
3 *
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.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 #ifndef SETUP_EXCEPTION_H
17 #define SETUP_EXCEPTION_H
18
19 #include <exception>
20 #include <string>
21 #include <typeinfo>
22 #include "msg.h"
23
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;
34 };
35
36 #define APPERR_CORRUPT_PACKAGE 1
37 #define APPERR_IO_ERROR 2
38 #define APPERR_LOGIC_ERROR 3
39 #define APPERR_WINDOW_ERROR 4
40
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()); \
51 }
52
53
54 #endif /* SETUP_EXCEPTION_H */
This page took 0.0443 seconds and 5 git commands to generate.