The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CoreException Class Reference

This class can be used on its own to represent an exception, or derived to represent a module-specific exception. More...

#include <base.h>

Inheritance diagram for CoreException:

Inheritance graph
[legend]
Collaboration diagram for CoreException:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CoreException ()
 Default constructor, just uses the error mesage 'Core threw an exception'.
 CoreException (const std::string &message)
 This constructor can be used to specify an error message before throwing.
 CoreException (const std::string &message, const std::string &src)
 This constructor can be used to specify an error message before throwing, and to specify the source of the exception.
virtual ~CoreException () throw ()
 This destructor solves world hunger, cancels the world debt, and causes the world to end.
virtual const char * GetReason ()
 Returns the reason for the exception.
virtual const char * GetSource ()

Protected Attributes

const std::string err
 Holds the error message to be displayed.
const std::string source
 Source of the exception.

Detailed Description

This class can be used on its own to represent an exception, or derived to represent a module-specific exception.

When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or a class derived from ModuleException. If a module throws an exception during its constructor, the module will not be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.

Definition at line 224 of file base.h.


Constructor & Destructor Documentation

CoreException::CoreException  )  [inline]
 

Default constructor, just uses the error mesage 'Core threw an exception'.

Definition at line 236 of file base.h.

CoreException::CoreException const std::string message  )  [inline]
 

This constructor can be used to specify an error message before throwing.

Definition at line 239 of file base.h.

CoreException::CoreException const std::string message,
const std::string src
[inline]
 

This constructor can be used to specify an error message before throwing, and to specify the source of the exception.

Definition at line 243 of file base.h.

virtual CoreException::~CoreException  )  throw () [inline, virtual]
 

This destructor solves world hunger, cancels the world debt, and causes the world to end.

Actually no, it does nothing. Never mind.

Exceptions:
Nothing! 

Definition at line 248 of file base.h.


Member Function Documentation

virtual const char* CoreException::GetReason  )  [inline, virtual]
 

Returns the reason for the exception.

The module should probably put something informative here as the user will see this upon failure.

Definition at line 252 of file base.h.

Referenced by ModuleFilter::AddFilter(), TreeSocket::AddLine(), UserManager::AddUser(), CullList::Apply(), BufferedSocket::Close(), ModuleSpanningTree::ConnectServer(), TestSuite::DoThreadTests(), BufferedSocket::FlushWriteBuffer(), CommandRLine::Handle(), BufferedSocket::InternalMarkConnected(), ModuleManager::Load(), UserResolver::OnLookupComplete(), ModuleSSLOpenSSL::OnRehash(), ModuleSSLGnuTLS::OnRehash(), ModuleIdent::OnUserRegister(), BufferedSocket::Read(), ServerConfig::Read(), ModuleFilter::ReadFilters(), User::StartDNSLookup(), and User::Write().

virtual const char* CoreException::GetSource  )  [inline, virtual]
 

Definition at line 257 of file base.h.

Referenced by UserManager::AddUser(), CullList::Apply(), BufferedSocket::Close(), BufferedSocket::FlushWriteBuffer(), BufferedSocket::InternalMarkConnected(), BufferedSocket::Read(), and User::Write().


Member Data Documentation

const std::string CoreException::err [protected]
 

Holds the error message to be displayed.

Definition at line 229 of file base.h.

const std::string CoreException::source [protected]
 

Source of the exception.

Definition at line 232 of file base.h.


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