Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
except.h
Go to the documentation of this file.
1 /*! \file xstream/except.h
2  *
3  * \brief Main header file for exception related to xstream library
4  *
5  */
6 
7 #ifndef __XSTREAM_EXCEPT_H
8 #define __XSTREAM_EXCEPT_H
9 
10 #include <xstream/config.h>
11 
12 #include <stdexcept>
13 #include <string>
14 #include <ios>
15 
16 namespace xstream{
17 
18 /*!
19  * \brief general errors only detected at runtime, no solution possible
20  *
21  */
22 
23 class fatal_error: public std::ios::failure
24 {
25  public:
26  fatal_error(const std::string& w):std::ios::failure(w){};
27 
28  /*!
29  * \brief describes the current library module
30  * (zlib,bzlib,base64,...)
31  *
32  */
33  virtual std::string module() const
34  {
35  return "xstream";
36  }
37 
38  virtual const char* what() const throw()
39  {
40  try{
41  std::string w=module();
42  w+=":: ";
43  w+=(std::ios::failure::what());
44  return w.c_str();
45  }
46  catch(...){
47  return std::ios::failure::what();
48  }
49  }
50 };
51 
52 #if 0
53 
54 /*!
55  * \brief general errors indicating bad usage of the library or unexpected situation, solution possible
56  *
57  */
58 class recoverable_error: public std::ios::failure {;
59  recoverable_error(const std::string& w):std::ios::failure(w){};
60 };
61 
62 #endif
63 
64 }//namespace xstream
65 
66 #endif
char string[256]
general errors only detected at runtime, no solution possible
Definition: except.h:23
fatal_error(const std::string &w)
Definition: except.h:26
virtual std::string module() const
describes the current library module (zlib,bzlib,base64,...)
Definition: except.h:33
virtual const char * what() const
Definition: except.h:38