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  void Report() const ;
119 
121 
125  int getErrcode() const ;
126 
128 
132  operator const char * () const;
133 
135 
139  std::string get_message() const ;
140 
142 
155  typedef void Handler_t (const Error);
156 
158 
174  static void setHandler( Gyoto::Error::Handler_t* phandler);
175 
176 };
177 
178 namespace Gyoto {
180  void throwError( std::string );
181 }
182 
183 #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.
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:155