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 
117  // Copy constructor
118  Error( const Gyoto::Error &o);
119 
121  void Report() const ;
122 
124 
128  int getErrcode() const ;
129 
131 
135  operator const char * () const;
136 
138 
142  std::string get_message() const ;
143 
145 
158  typedef void Handler_t (const Error);
159 
161 
177  static void setHandler( Gyoto::Error::Handler_t* phandler);
178 
179 };
180 
181 namespace Gyoto {
183  void throwError( std::string );
184 }
185 
186 #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.
const int errcode
Error code.
Definition: GyotoError.h:110
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
void throwError(std::string)
Throw a Gyoto::Error.
void Handler_t(const Error)
Error handler type.
Definition: GyotoError.h:158
int getErrcode() const
Retrieve error code.
void Report() const
Print-out error message on standard error.