author | Michael Krelin <hacker@klever.net> | 2008-04-05 11:17:33 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-04-05 11:17:33 (UTC) |
commit | 04fb190243442e83349f129b523ab747e58100bf (patch) (side-by-side diff) | |
tree | ddc28357fbe78b07fd3a5e0aa8088130bf305829 /include/napkin/exception.h | |
download | napkin-0.0.zip napkin-0.0.tar.gz napkin-0.0.tar.bz2 |
Initial commit into public repository0.0
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/napkin/exception.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/napkin/exception.h b/include/napkin/exception.h new file mode 100644 index 0000000..b317886 --- a/dev/null +++ b/include/napkin/exception.h @@ -0,0 +1,36 @@ +#ifndef __NAPKIN_EXCEPTION_H +#define __NAPKIN_EXCEPTION_H + +#include <stdexcept> +#include <string> + +#define NAPKIN_E_SUBCLASS(derived,base) \ + class derived : public base { \ + public: \ + explicit derived(const string& w) \ + : base(w) { } \ + } + +namespace napkin { + using std::string; + + class exception : public std::runtime_error { + public: + explicit exception(const string& w) + : std::runtime_error(w) { } + ~exception() throw() { } + }; + + NAPKIN_E_SUBCLASS(exception_sleeptracker,exception); + NAPKIN_E_SUBCLASS(exception_st_port,exception_sleeptracker); + NAPKIN_E_SUBCLASS(exception_st_data,exception_sleeptracker); + NAPKIN_E_SUBCLASS(exception_st_data_envelope,exception_st_data); + NAPKIN_E_SUBCLASS(exception_st_data_integrity,exception_st_data_envelope); + + NAPKIN_E_SUBCLASS(exception_db,exception); + NAPKIN_E_SUBCLASS(exception_db_already,exception_db); +} + +#undef NAPKIN_E_SUBCLASS + +#endif /* __NAPKIN_EXCEPTION_H */ |