NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
Exceptions

Defines the library-wide exception hierarchy and error handling macros. More...

Classes

class  nnl::Exception
 Base exception class for the library specific exceptions. More...
class  nnl::RuntimeError
 Exception thrown for generic runtime errors. More...
class  nnl::ParseError
 Exception thrown for parsing errors. More...
class  nnl::PreconditionError
 Exception thrown when a contract precondition is violated. More...
class  nnl::RangeError
 Exception thrown for out-of-range errors. More...
class  nnl::NarrowError
 Exception thrown for narrowing conversion errors. More...
class  nnl::IOError
 Exception thrown for I/O like operations. More...

Macros

#define NNL_THROW(object)
 Throws an exception or terminates the program if exceptions are disabled.
#define NNL_TRY   if (true)
 Expands to a try statement; or a dummy if statement when exceptions are disabled.
#define NNL_CATCH(type)
 Expands to a catch statement; or a dummy if statement when exceptions are disabled.

Detailed Description

Defines the library-wide exception hierarchy and error handling macros.


Class Documentation

◆ nnl::Exception

class nnl::Exception

Base exception class for the library specific exceptions.

Inherited by nnl::IOError, nnl::NarrowError, nnl::ParseError, nnl::PreconditionError, nnl::RangeError, and nnl::RuntimeError.

◆ nnl::RuntimeError

class nnl::RuntimeError

Exception thrown for generic runtime errors.

Inherits nnl::Exception.

◆ nnl::ParseError

class nnl::ParseError

Exception thrown for parsing errors.

Inherits nnl::Exception.

◆ nnl::PreconditionError

class nnl::PreconditionError

Exception thrown when a contract precondition is violated.

Note
Used only when the NNL_THROW_ON_CONTRACT_VIOLATION CMake option is enabled. Otherwise, contract violations are fatal.
See also
NNL_EXPECTS

Inherits nnl::Exception.

◆ nnl::RangeError

class nnl::RangeError

Exception thrown for out-of-range errors.

Inherits nnl::Exception.

◆ nnl::NarrowError

class nnl::NarrowError

Exception thrown for narrowing conversion errors.

See also
nnl::utl::data::narrow

Inherits nnl::Exception.

◆ nnl::IOError

class nnl::IOError

Exception thrown for I/O like operations.

See also
nnl::RWBase

Inherits nnl::Exception.

Macro Definition Documentation

◆ NNL_CATCH

#define NNL_CATCH ( type)
Value:
else if (type e; false)

Expands to a catch statement; or a dummy if statement when exceptions are disabled.

Parameters
typeThe unqualified non-pointer type to catch

◆ NNL_THROW

#define NNL_THROW ( object)
Value:
{ nnl::Panic(object.what()); }

Throws an exception or terminates the program if exceptions are disabled.

Parameters
objectThe exception object to be thrown

◆ NNL_TRY

#define NNL_TRY   if (true)

Expands to a try statement; or a dummy if statement when exceptions are disabled.