cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches

#include <CepGen/Core/Exception.h>

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

Public Types

enum  Type { undefined = -1 , error , fatal }
 Enumeration of exception severities. More...
 
enum class  MessageType {
  undefined = -1 , debug , verbatim , info ,
  warning
}
 Enumeration of message type. More...
 

Public Member Functions

 Exception (const char *mod, const char *from="", Type type=Type::undefined, const char *file="", short lineno=0) noexcept
 
virtual ~Exception () noexcept override
 Destructor (potentially killing the process)
 
void dump (std::ostream *os=nullptr) const noexcept override
 Human-readable dump of the exception.
 
const char * what () const noexcept override
 
template<typename T >
const LoggedMessagelog (T &&lam) noexcept
 Lambda function handler.
 
std::string message () const
 Human-readable message.
 
const std::string & from () const
 Origin of the exception.
 
const std::string & file () const
 File where the exception occured.
 
short lineNumber () const
 Line number where the exception occured.
 
const MessageTypetype () const
 Message type.
 
std::ostream & stream ()
 Output stream object.
 

Static Public Member Functions

static std::string now ()
 Human-readable date/time.
 

Protected Attributes

std::ostringstream message_
 Message to throw.
 
std::string from_
 Origin of the exception.
 
std::string file_
 File.
 
short line_num_
 Line number.
 

Friends

std::ostream & operator<< (std::ostream &, const Type &)
 Printout operator for exception type.
 
template<typename T >
const Exceptionoperator<< (const Exception &exc, const T &var) noexcept
 

Detailed Description

Definition at line 25 of file Exception.h.

Member Enumeration Documentation

◆ MessageType

enum class MessageType
stronginherited
Enumerator
undefined 

Irregular message.

debug 

Debugging information to be enabled.

verbatim 

Raw information.

info 

Prettified information.

warning 

Casual non-stopping warning.

Definition at line 47 of file Message.h.

◆ Type

enum Type
Enumerator
undefined 

Irregular message.

error 

General non-stopping error.

fatal 

Critical and stopping error.

Definition at line 28 of file Exception.h.

Constructor & Destructor Documentation

◆ Exception()

Exception ( const char *  mod,
const char *  from = "",
Type  type = Type::undefined,
const char *  file = "",
short  lineno = 0 
)
explicitnoexcept

Definition at line 25 of file Exception.cpp.

◆ ~Exception()

~Exception ( )
overridevirtualnoexcept

Definition at line 30 of file Exception.cpp.

Member Function Documentation

◆ dump()

void dump ( std::ostream *  os = nullptr) const
overridevirtualnoexcept

Implements Message.

Definition at line 41 of file Exception.cpp.

◆ file()

const std::string & file ( ) const
inherited

Definition at line 163 of file Message.h.

◆ from()

const std::string & from ( ) const
inherited

Definition at line 161 of file Message.h.

◆ lineNumber()

short lineNumber ( ) const
inherited

Definition at line 165 of file Message.h.

◆ log()

template<typename T >
const LoggedMessage & log ( T &&  lam)
noexceptinherited

Definition at line 152 of file Message.h.

◆ message()

std::string message ( ) const
inherited

Definition at line 158 of file Message.h.

◆ now()

std::string now ( )
staticinherited

Definition at line 23 of file Message.cpp.

◆ stream()

std::ostream & stream ( )
inherited

Definition at line 171 of file Message.h.

◆ type()

const MessageType & type ( ) const
inherited

Definition at line 167 of file Message.h.

◆ what()

const char * what ( ) const
overridenoexcept

Definition at line 36 of file Exception.cpp.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

template<typename T >
const Exception & operator<< ( const Exception exc,
const T &  var 
)
friend

Definition at line 45 of file Exception.h.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  os,
const Type type 
)
friend

Definition at line 59 of file Exception.cpp.

Member Data Documentation

◆ file_

std::string file_
protectedinherited

Definition at line 176 of file Message.h.

◆ from_

std::string from_
protectedinherited

Definition at line 175 of file Message.h.

◆ line_num_

short line_num_
protectedinherited

Definition at line 177 of file Message.h.

◆ message_

std::ostringstream message_
protectedinherited

Definition at line 174 of file Message.h.