Gyoto
GyotoError.h
Go to the documentation of this file.
1 
34 /*
35  Copyright 2011, 2013 Thibaut Paumard
36 
37  This file is part of Gyoto.
38 
39  Gyoto is free software: you can redistribute it and/or modify
40  it under the terms of the GNU General Public License as published by
41  the Free Software Foundation, either version 3 of the License, or
42  (at your option) any later version.
43 
44  Gyoto is distributed in the hope that it will be useful,
45  but WITHOUT ANY WARRANTY; without even the implied warranty of
46  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47  GNU General Public License for more details.
48 
49  You should have received a copy of the GNU General Public License
50  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
51  */
52 
53 #ifndef __GyotoError_H_
54 #define __GyotoError_H_
55 
61 #include <string>
62 
63 namespace Gyoto {
64  class Error;
65 }
66 
100 {
101  private:
103  const std::string message;
104 
106 
110  const int errcode;
111 
112  public:
113 
115  Error( const std::string m );
116 
118  Error( const int errcode );
119 
121  Error( const std::string m, const int errcode );
122 
124  void Report() const ;
125 
127 
131  int getErrcode() const ;
132 
134 
138  operator const char * () const;
139 
141 
145  std::string get_message() const ;
146 
148 
161  typedef void Handler_t (const Error);
162 
164 
180  static void setHandler( Gyoto::Error::Handler_t* phandler);
181 
182 };
183 
184 namespace Gyoto {
186  void throwError( std::string );
187 }
188 
189 #endif
static void setHandler(Gyoto::Error::Handler_t *phandler)
Set application error handler.
const std::string message
Error message.
Definition: GyotoError.h:103
Class for thowing exceptions.
Definition: GyotoError.h:99
std::string get_message() const
Retrieve error message for custom handling of the exception.
Error(const std::string m)
Constructor with an error message.
void Report() const
Print-out error message on standard error.
const int errcode
Error code.
Definition: GyotoError.h:110
int getErrcode() const
Retrieve error code.
void throwError(std::string)
Throw a Gyoto::Error.
void Handler_t(const Error)
Error handler type.
Definition: GyotoError.h:161