ipaddress 1.1.0
Loading...
Searching...
No Matches
error Class Reference

The primary exception class used by the IP address library. More...

#include <errors.hpp>

Inheritance diagram for error:

Public Member Functions

template<typename FirstArg , typename... Args>
 error (error_code code, const FirstArg &arg, const Args &... args)
 Constructs an error with a code and a concatenated message from multiple arguments.
 
 error (error_code code, const std::string &message)
 Constructs an error with a code and a message string.
 
 error (error_code code, const char *message)
 Constructs an error with a code and a message C-string.
 
error_code code () const noexcept
 Returns the error code associated with this error.
 

Detailed Description

The primary exception class used by the IP address library.

This class extends the standard std::runtime_error and serves as the base exception type for the library. It is designed to be thrown when an error condition is encountered during the processing of IP addresses, such as parsing errors or logical inconsistencies.

The error class encapsulates an error_code value representing the specific error that occurred, along with a descriptive message that provides context about the error. This design allows for precise and informative error reporting, aiding in debugging and error handling.

Overall, the error class is a critical component of the library's error management system, providing a standardized way to handle exceptions throughout the library.

See also
parse_error
logic_error

Constructor & Destructor Documentation

◆ error() [1/3]

template<typename FirstArg , typename... Args>
error ( error_code code,
const FirstArg & arg,
const Args &... args )
inlineexplicit

Constructs an error with a code and a concatenated message from multiple arguments.

Template Parameters
FirstArgThe type of the first argument passed to the constructor.
ArgsThe types of the additional arguments passed to the constructor.
Parameters
[in]codeThe error code associated with the exception.
[in]argThe first argument describing the error.
[in]argsAdditional arguments describing the error.

◆ error() [2/3]

error ( error_code code,
const std::string & message )
inlineexplicit

Constructs an error with a code and a message string.

Parameters
[in]codeThe error code associated with the exception.
[in]messageA detailed description of the error.

◆ error() [3/3]

error ( error_code code,
const char * message )
inlineexplicit

Constructs an error with a code and a message C-string.

Parameters
[in]codeThe error code associated with the exception.
[in]messageA detailed description of the error.

Member Function Documentation

◆ code()

error_code code ( ) const
inlinenoexcept

Returns the error code associated with this error.

Returns
The error code that represents the specific error condition.

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