Public Member Functions | List of all members
BPrivate::Network::BSystemError Class Reference

Advanced error object that wrap low-level system errors. More...

Inherits BPrivate::Network::BError.

Public Member Functions

 BSystemError (BString origin, status_t error)
 Create an object for error code with a specified origin. More...
 
 BSystemError (BSystemError &&other) noexcept
 Move constructor. More...
 
 BSystemError (const BSystemError &other)
 Copy constructor. More...
 
 BSystemError (const char *origin, status_t error)
 Create an object for error code with a specified origin. More...
 
virtual BString DebugMessage () const override
 Retrieve a debug message that contains all info in this error. More...
 
status_t Error () noexcept
 Get the error code for this error. More...
 
virtual const char * Message () const noexcept override
 Access the string representation of the message. More...
 
BSystemErroroperator= (BSystemError &&other) noexcept
 Move assignment operator. More...
 
BSystemErroroperator= (const BSystemError &other)
 Copy assignment. More...
 
- Public Member Functions inherited from BPrivate::Network::BError
 BError (BError &&error) noexcept
 Move constructor. More...
 
 BError (BString origin)
 Constructor that sets the origin. More...
 
 BError (const BError &error)
 Copy constructor. More...
 
 BError (const char *origin)
 Constructor that sets the origin. More...
 
virtual ~BError () noexcept
 Standard destructor. More...
 
BErroroperator= (BError &&error) noexcept
 Move assignment operator. More...
 
BErroroperator= (const BError &error)
 Copy assignment operator. More...
 
virtual const char * Origin () const noexcept
 Access the string representation of the origin of the error. More...
 
size_t WriteToOutput (BDataIO *output) const
 Write the error description to an output. More...
 
void WriteToStream (std::ostream &stream) const
 Write the error description to an output stream. More...
 

Detailed Description

Advanced error object that wrap low-level system errors.

A BSystemError is a concrete advanced error object that is used to wrap tradition errors that are usually returned as a status_t. This type takes the system error, and adds an origin specifier.

Since
Haiku R1

Constructor & Destructor Documentation

◆ BSystemError() [1/4]

BPrivate::Network::BSystemError::BSystemError ( const char *  origin,
status_t  error 
)

Create an object for error code with a specified origin.

Parameters
originA string representing where this error occured. As this object usually wraps around a lower level API call, this should usually be the call that the error code originated from.
errorThe error code.
Since
Haiku R1

◆ BSystemError() [2/4]

BPrivate::Network::BSystemError::BSystemError ( BString  origin,
status_t  error 
)

Create an object for error code with a specified origin.

Parameters
originA string representing where this error occured. As this object usually wraps around a lower level API call, this should usually be the call that the error code originated from.
errorThe error code.
Since
Haiku R1

◆ BSystemError() [3/4]

BPrivate::Network::BSystemError::BSystemError ( const BSystemError other)

Copy constructor.

Since
Haiku R1

◆ BSystemError() [4/4]

BPrivate::Network::BSystemError::BSystemError ( BSystemError &&  other)
noexcept

Move constructor.

Since
Haiku R1

Member Function Documentation

◆ DebugMessage()

BString BPrivate::Network::BSystemError::DebugMessage ( ) const
overridevirtual

Retrieve a debug message that contains all info in this error.

[Origin] Message of error (error code)
Exceptions
std::bad_allocIn the future this method may throw this exception when the memory for the debug message cannot be allocated.
Returns
A BString object that contains the debug message.
Since
Haiku R1

Reimplemented from BPrivate::Network::BError.

◆ Error()

status_t BPrivate::Network::BSystemError::Error ( )
noexcept

Get the error code for this error.

Since
Haiku R1

◆ Message()

const char * BPrivate::Network::BSystemError::Message ( ) const
overridevirtualnoexcept

Access the string representation of the message.

This returns the value of strerror() for the error code.

Since
Haiku R1

Implements BPrivate::Network::BError.

◆ operator=() [1/2]

BSystemError & BPrivate::Network::BSystemError::operator= ( BSystemError &&  other)
noexcept

Move assignment operator.

Since
Haiku R1

◆ operator=() [2/2]

BSystemError & BPrivate::Network::BSystemError::operator= ( const BSystemError other)

Copy assignment.

Since
Haiku R1
BPrivate::Network::BSystemError::Message
virtual const char * Message() const noexcept override
Access the string representation of the message.
BPrivate::Network::BError::Origin
virtual const char * Origin() const noexcept
Access the string representation of the origin of the error.