E-MailRelay
Public Member Functions | List of all members
G::Exception Class Reference

A general-purpose exception class derived from std::exception and containing an error message. More...

#include <gexception.h>

+ Inheritance diagram for G::Exception:
+ Collaboration diagram for G::Exception:

Public Member Functions

 Exception (std::initializer_list< std::string_view >)
 Constructor. More...
 
 Exception (std::string_view what)
 Constructor. More...
 
 Exception (std::string_view what, std::string_view more)
 Constructor. More...
 
 Exception (std::string_view what, std::string_view more1, std::string_view more2)
 Constructor. More...
 
 Exception (std::string_view what, std::string_view more1, std::string_view more2, std::string_view more3)
 Constructor. More...
 
 Exception (std::string_view what, std::string_view more1, std::string_view more2, std::string_view more3, std::string_view more4)
 Constructor. More...
 

Detailed Description

A general-purpose exception class derived from std::exception and containing an error message.

Provides constructors that simplify the assembly of multi-part error messages.

Usage:

throw G::Exception( "initialisation error" , "no such file" , path ) ;
A general-purpose exception class derived from std::exception and containing an error message.
Definition: gexception.h:64

The G_EXCEPTION macro is normally used in class declarations, as follows:

class Foo
{
public:
G_EXCEPTION( Error , tx("foo error") ) ;
...
};
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().
Definition: ggettext.h:84

The tx() identifies the string at build-time as requiring translation. The G_EXCEPTION macro adds a "G::" scope so that at compile-time the do-nothing function G::tx() from "ggettext.h" is used. The xgettext utility should be run as "xgettext --c++ --keyword=tx". Note that xgettext keywords cannot use scoped names.

Definition at line 63 of file gexception.h.

Constructor & Destructor Documentation

◆ Exception() [1/6]

G::Exception::Exception ( std::initializer_list< std::string_view >  args)

Constructor.

Definition at line 25 of file gexception.cpp.

◆ Exception() [2/6]

G::Exception::Exception ( std::string_view  what)
explicit

Constructor.

Definition at line 30 of file gexception.cpp.

◆ Exception() [3/6]

G::Exception::Exception ( std::string_view  what,
std::string_view  more 
)

Constructor.

Definition at line 35 of file gexception.cpp.

◆ Exception() [4/6]

G::Exception::Exception ( std::string_view  what,
std::string_view  more1,
std::string_view  more2 
)

Constructor.

Definition at line 40 of file gexception.cpp.

◆ Exception() [5/6]

G::Exception::Exception ( std::string_view  what,
std::string_view  more1,
std::string_view  more2,
std::string_view  more3 
)

Constructor.

Definition at line 45 of file gexception.cpp.

◆ Exception() [6/6]

G::Exception::Exception ( std::string_view  what,
std::string_view  more1,
std::string_view  more2,
std::string_view  more3,
std::string_view  more4 
)

Constructor.

Definition at line 51 of file gexception.cpp.


The documentation for this class was generated from the following files: