NetServices: Add the BNetworkRequestError type
This is a generic error type that can be used by multiple protocols to describe errors that can occur while processing a request. The error type supports adding an additional error code in cases where there is an underlying system error. The type will be used to describe errors that occur while processing requests by BHttpSession, and it is generally going to be thrown by the receiving BHttpResult. Change-Id: I76c0bbaedd38df8cfb79159c4beae2fbf1350aab
This commit is contained in:
@@ -50,6 +50,31 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class BNetworkRequestError : public BError {
|
||||
public:
|
||||
enum ErrorType {
|
||||
HostnameError,
|
||||
NetworkError,
|
||||
ProtocolError,
|
||||
SystemError,
|
||||
Canceled
|
||||
};
|
||||
|
||||
BNetworkRequestError(const char* origin, ErrorType type,
|
||||
status_t errorCode = B_OK);
|
||||
|
||||
virtual const char* Message() const noexcept override;
|
||||
virtual BString DebugMessage() const override;
|
||||
|
||||
ErrorType Type() const noexcept;
|
||||
status_t ErrorCode() const noexcept;
|
||||
|
||||
private:
|
||||
ErrorType fErrorType;
|
||||
status_t fErrorCode = B_OK;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user