From 04fb190243442e83349f129b523ab747e58100bf Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 05 Apr 2008 11:17:33 +0000 Subject: Initial commit into public repository Signed-off-by: Michael Krelin --- (limited to 'include/napkin/exception.h') 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 +#include + +#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 */ -- cgit v0.9.0.2