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
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 #ifndef SETUP_EXCEPTION_H
17 #define SETUP_EXCEPTION_H
24 class Exception
: public std::exception
{
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();
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) \
44 fatal((owner), IDS_UNCAUGHT_EXCEPTION_WITH_ERRNO, (threadname), \
45 typeid(*e).name(), e->what(), e->errNo()); \
47 catch (std::exception *e) \
49 fatal((owner), IDS_UNCAUGHT_EXCEPTION, (threadname), \
50 typeid(*e).name(), e->what()); \
54 #endif /* SETUP_EXCEPTION_H */