dodo  0.0.1
A C++ library to create containerized Linux services
dodo::common::Exception Class Reference

An Exception is thrown in exceptional circumstances, and its occurrence should generally imply that the program should stop, as it has entered a state it was never designed to handle. More...

#include <exception.hpp>

Inheritance diagram for dodo::common::Exception:
Collaboration diagram for dodo::common::Exception:

Public Member Functions

 Exception (const std::string &file, unsigned int line, const std::string &what)
 Construct an Exception. More...
 
 Exception (const std::string &file, unsigned int line, const std::string &what, const DebugObject *thing)
 Construct an Exception. More...
 
const std::string & getFile () const
 Return the source file where the exception was thrown. More...
 
unsigned int getLine () const
 Return the line number in the source file where the exception was thrown. More...
 
virtual const char * what () const noexcept
 Return the exception message. More...
 

Protected Attributes

std::string file_
 The source file. More...
 
unsigned int line_
 The source line number. More...
 
std::string msg_
 The exception message. More...
 

Detailed Description

An Exception is thrown in exceptional circumstances, and its occurrence should generally imply that the program should stop, as it has entered a state it was never designed to handle.

When used in conjunction with the throw_Exception() and throw_SystemException() macros, the source file and line number where the Exception is thrown are picked up automatically.

Definition at line 83 of file exception.hpp.

Constructor & Destructor Documentation

◆ Exception() [1/2]

dodo::common::Exception::Exception ( const std::string &  file,
unsigned int  line,
const std::string &  what 
)

Construct an Exception.

Use the throw_Exception() macro to construct and throw Exceptions.

Parameters
fileThe source file where the exception was raised.
lineThe line number where the exception was raised.
whatThe exception message.

Definition at line 55 of file exception.cpp.

References file_, line_, msg_, and what().

Here is the call graph for this function:

◆ Exception() [2/2]

dodo::common::Exception::Exception ( const std::string &  file,
unsigned int  line,
const std::string &  what,
const DebugObject thing 
)

Construct an Exception.

Use the throw_ExceptionObject() macro to construct and throw Exceptions.

Parameters
fileThe source file where the exception was raised.
lineThe line number where the exception was raised.
whatThe exception message.
thingThe exception context.

Definition at line 62 of file exception.cpp.

References dodo::common::DebugObject::debugString(), file_, line_, msg_, and what().

Here is the call graph for this function:

Member Function Documentation

◆ getFile()

const std::string& dodo::common::Exception::getFile ( ) const
inline

Return the source file where the exception was thrown.

Returns
The source file where the exception was thrown.

Definition at line 118 of file exception.hpp.

References file_.

◆ getLine()

unsigned int dodo::common::Exception::getLine ( ) const
inline

Return the line number in the source file where the exception was thrown.

Returns
The line number in the source file where the exception was thrown.

Definition at line 124 of file exception.hpp.

References line_.

◆ what()

const char * dodo::common::Exception::what ( ) const
virtualnoexcept

Return the exception message.

Returns
the exception message.

Definition at line 73 of file exception.cpp.

References msg_.

Referenced by Exception(), and dodo::network::TCPListener::run().

Here is the caller graph for this function:

Field Documentation

◆ file_

std::string dodo::common::Exception::file_
protected

The source file.

Definition at line 124 of file exception.hpp.

Referenced by Exception(), and getFile().

◆ line_

unsigned int dodo::common::Exception::line_
protected

The source line number.

Definition at line 129 of file exception.hpp.

Referenced by Exception(), and getLine().

◆ msg_

std::string dodo::common::Exception::msg_
protected

The exception message.

Definition at line 131 of file exception.hpp.

Referenced by Exception(), and what().


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