Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
BPrivate::Network::BNetworkRequestError Class Reference

Error that indicates there was an issue executing the network request. More...

Inherits BPrivate::Network::BError.

Public Types

enum  ErrorType {
  HostnameError ,
  NetworkError ,
  ProtocolError ,
  SystemError ,
  Canceled
}
 A list of errors that can occur while executing a network request. More...
 

Public Member Functions

 BNetworkRequestError (const char *origin, ErrorType type, const BString &customMessage=BString())
 Create a new network request error.
 
 BNetworkRequestError (const char *origin, ErrorType type, status_t errorCode, const BString &customMessage=BString())
 Create a new network request error.
 
const char * CustomMessage () const noexcept
 Get the custom error message.
 
virtual BString DebugMessage () const override
 Retrieve a debug message that contains all info in this error.
 
status_t ErrorCode () const noexcept
 Get the underlying system error code.
 
virtual const char * Message () const noexcept override
 Access the string representation of the message.
 
ErrorType Type () const noexcept
 Get the error type.
 
- 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

Error that indicates there was an issue executing the network request.

Since
Haiku R1

Constructor & Destructor Documentation

◆ BNetworkRequestError() [1/2]

BPrivate::Network::BNetworkRequestError::BNetworkRequestError ( const char *  origin,
ErrorType  type,
status_t  errorCode,
const BString customMessage = BString() 
)

Create a new network request error.

Parameters
originA string representing where this error occured. It is advised to initialize it to __PRETTY_FUNCTION__ by default.
typeThe error type that describes what the issue was that prevented the completion of the request.
errorCodeThe underlying system error. See the BNetworkRequestError::ErrorType documentation on which error types expect a system error.
customMessageOptional custom message describing the reason or cause for the error.
Since
Haiku R1

◆ BNetworkRequestError() [2/2]

BPrivate::Network::BNetworkRequestError::BNetworkRequestError ( const char *  origin,
ErrorType  type,
const BString customMessage = BString() 
)

Create a new network request error.

Parameters
originA string representing where this error occured. It is advised to initialize it to __PRETTY_FUNCTION__ by default.
typeThe error type that describes what the issue was that prevented the completion of the request.
customMessageOptional custom message describing the reason or cause for the error.
Since
Haiku R1

Member Function Documentation

◆ CustomMessage()

const char * BPrivate::Network::BNetworkRequestError::CustomMessage ( ) const
noexcept

Get the custom error message.

Returns
Get the custom error message. This may be an empty string if it was not set.
Since
Haiku R1

◆ DebugMessage()

virtual BString BPrivate::Network::BNetworkRequestError::DebugMessage ( ) const
overridevirtual

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

[Origin] Message of error
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.

◆ ErrorCode()

status_t BPrivate::Network::BNetworkRequestError::ErrorCode ( ) const
noexcept

Get the underlying system error code.

Returns
A status_t error code when the associated BNetworkRequestError::ErrorType sets the system error, or B_OK if there is no additional error code available.
Since
Haiku R1

◆ Message()

virtual const char * BPrivate::Network::BNetworkRequestError::Message ( ) const
overridevirtualnoexcept

Access the string representation of the message.

Implementations should return a meaningful description of the error that occured. The primary target audience of these messages are developers, who (hopefully) see them during development, testing or in bug reports. However, if it makes sense to have the error messages be instructive to users too, then do not hesitate to do so.

Implementations of this function should never return NULL.

Since
Haiku R1

Implements BPrivate::Network::BError.

◆ Type()

ErrorType BPrivate::Network::BNetworkRequestError::Type ( ) const
noexcept

Get the error type.

Returns
Get the BNetworkRequestError::ErrorType that describes the cause for the request to fail.
Since
Haiku R1