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

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)
virtual const char * Origin() const noexcept
Access the string representation of the origin of the error.
virtual const char * Message() const noexcept override
Access the string representation of the message.
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