]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservcore/include/GameServ/GameServException.h
1 #ifndef __GS__GAMESERVEXCEPTION_H__
2 #define __GS__GAMESERVEXCEPTION_H__
9 //! GameServ generic exceptions
12 //! Generic base exception for all GameServ related exceptions that occur
14 These generic exception allows applications and services to catch
15 all exceptions in a generic way, and even pass them off to log files,
16 etc. It's recommended that developers make use of the standard macros
17 __FILE__ and __LINE__. You can compose exception error message strings
18 using boost's format function coupled with boost::str like so:
21 str(format("Failed to jump rope at time of %1%:%2%") % hour % minute));
24 Developers should use caution when adding exceptions. Exceptions are great
25 for finding errors cross boundries, they shouldn't be used as interrupt handlers
26 or methods to localize handling of error conditions.
28 class GameServException
31 //! Fully composed exception
33 Recommended construction for a GameServ exception that helps developers and
35 \param ErrorMsg The custom error message to associated with the
36 exception. Even though this is a reference, it's copied locally to
38 \param Filename The name of the source file, use the standard macro
40 \param SourceLine The line number that the error occurred on, use
43 GameServException(const string
&ErrorMsg
, const char *Filename
, int SourceLine
);
45 //! Partially composed exception
48 \param ErrorMsg The custom error message to associated with the
49 exception. Even though this is a reference, it's copied locally to
52 GameServException(const string
&ErrorMsg
);
56 This is a generic GameServ exception constructor
58 GameServException(void);
60 // Properties /////////////////////////////////////////////////////////////
62 //! Property get: Error Message
63 const string
ErrorMessage(void) const;
65 //! Property get: Source Filename
66 const char *Filename(void) const;
68 //! Property get: Source Line Number
69 const int LineNumber(void) const;
71 //! Property get: Builds a full error string
72 const string
VerboseError(void) const;
77 const char *mpFilename
;