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. | |
BError & | operator= (BError &&error) noexcept |
Move assignment operator. | |
BError & | operator= (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. | |
Error that indicates there was an issue executing the network request.
BPrivate::Network::BNetworkRequestError::BNetworkRequestError | ( | const char * | origin, |
ErrorType | type, | ||
status_t | errorCode, | ||
const BString & | customMessage = BString() |
||
) |
Create a new network request error.
origin | A string representing where this error occured. It is advised to initialize it to __PRETTY_FUNCTION__ by default. |
type | The error type that describes what the issue was that prevented the completion of the request. |
errorCode | The underlying system error. See the BNetworkRequestError::ErrorType documentation on which error types expect a system error. |
customMessage | Optional custom message describing the reason or cause for the error. |
BPrivate::Network::BNetworkRequestError::BNetworkRequestError | ( | const char * | origin, |
ErrorType | type, | ||
const BString & | customMessage = BString() |
||
) |
Create a new network request error.
origin | A string representing where this error occured. It is advised to initialize it to __PRETTY_FUNCTION__ by default. |
type | The error type that describes what the issue was that prevented the completion of the request. |
customMessage | Optional custom message describing the reason or cause for the error. |
|
noexcept |
Get the custom error message.
|
overridevirtual |
Retrieve a debug message that contains all info in this error.
std::bad_alloc | In the future this method may throw this exception when the memory for the debug message cannot be allocated. |
Reimplemented from BPrivate::Network::BError.
|
noexcept |
Get the underlying system error code.
status_t
error code when the associated BNetworkRequestError::ErrorType sets the system error, or B_OK
if there is no additional error code available.
|
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
.
Implements BPrivate::Network::BError.
|
noexcept |
Get the error type.