DBRequestError
Objective-C
@interface DBRequestError : NSObject
Swift
class DBRequestError : NSObject
Base class for generic network request error (as opposed to route-specific error).
This class is represented almost like a Stone “Union” object. As one object, it can represent a number of error
“states” (see all of the values of DBRequestErrorType). To handle each error type, call each of the
is<TAG_STATE> methods until you determine the current tag state, then call the corresponding as<TAG_STATE>
method to return an instance of the appropriate error type.
For example:
if ([dbxError isHTTPError]) { DBHttpError *httpError = [dbxError asHttpError]; } else if ([dbxError isBadInputError]) { ……..
-
Current state of the
DBRequestErrorobject type.Declaration
Objective-C
@property (nonatomic, readonly) DBRequestErrorTag tag;Swift
var tag: DBRequestErrorTag { get } -
The Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API. Please include the value of this field when submitting technical support inquiries to Dropbox.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *requestId;Swift
var requestId: String? { get } -
The HTTP response status code of the request.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *statusCode;Swift
var statusCode: NSNumber? { get } -
A string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *errorContent;Swift
var errorContent: String? { get } -
An object containing a localized human-readable error message that is optionally returned from some API endpoints.
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) DBLocalizedUserMessage *userMessage;Swift
var userMessage: DBLocalizedUserMessage? { get } -
The structured object returned by the Dropbox API in the event of a 401 auth error.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) DBAUTHAuthError *structuredAuthError;Swift
var structuredAuthError: DBAUTHAuthError? { get } -
The structured object returned by the Dropbox API in the event of a 403 access error.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) DBAUTHAccessError *structuredAccessError;Swift
var structuredAccessError: DBAUTHAccessError? { get } -
The structured object returned by the Dropbox API in the event of a 422 path root error.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) DBCOMMONPathRootError *structuredPathRootError;Swift
var structuredPathRootError: DBCOMMONPathRootError? { get } -
The structured object returned by the Dropbox API in the event of a 429 rate-limit error.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) DBAUTHRateLimitError *structuredRateLimitError;Swift
var structuredRateLimitError: DBAUTHRateLimitError? { get } -
The number of seconds to wait before making any additional requests in the event of a rate-limit error.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *backoff;Swift
var backoff: NSNumber? { get } -
The client-side
NSErrorobject returned from the failed response.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSError *nsError;Swift
var nsError: Error? { get }
-
DBRequestErrorconvenience constructor.Initializes the
DBRequestErrorobject with all the required state for representing a generic HTTP error.Declaration
Objective-C
- (nonnull instancetype)initAsHttpError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage: (nullable DBLocalizedUserMessage *)userMessage;Swift
init(asHttpError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
Return Value
An initialized
DBRequestErrorinstance with HTTP error state. -
DBRequestError convenience constructor.
Initializes the
DBRequestErrorwith all the required state for representing a Bad Input error.Declaration
Objective-C
- (nonnull instancetype)initAsBadInputError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *) userMessage;Swift
init(asBadInputError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
Return Value
An initialized
DBRequestErrorinstance with Bad Input error state. -
DBRequestError convenience constructor.
Initializes the
DBRequestErrorwith all the required state for representing an Auth error.Declaration
Objective-C
- (nonnull instancetype) initAsAuthError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage structuredAuthError:(nonnull DBAUTHAuthError *)structuredAuthError;Swift
init(asAuthError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?, structuredAuthError: DBAUTHAuthError)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
structuredAuthErrorThe structured object returned by the Dropbox API in the event of a 401 auth error.
Return Value
An initialized
DBRequestErrorinstance with Auth error state. -
DBRequestError convenience constructor.
Initializes the
DBRequestErrorwith all the required state for representing an Access error.Declaration
Objective-C
- (nonnull instancetype) initAsAccessError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage structuredAccessError:(nonnull DBAUTHAccessError *)structuredAccessError;Swift
init(asAccessError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?, structuredAccessError: DBAUTHAccessError)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
structuredAccessErrorThe structured object returned by the Dropbox API in the event of a 403 access error.
Return Value
An initialized
DBRequestErrorinstance with Auth error state. -
DBRequestError convenience constructor.
Initializes the
DBRequestErrorwith all the required state for representing a Path Root error.Declaration
Objective-C
- (nonnull instancetype) initAsPathRootError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage structuredPathRootError: (nonnull DBCOMMONPathRootError *)structuredPathRootError;Swift
init(asPathRootError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?, structuredPathRootError: DBCOMMONPathRootError)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
structuredPathRootErrorThe structured object returned by the Dropbox API in the event of a 422 path root error.
Return Value
An initialized
DBRequestErrorinstance with Auth error state. -
DBRequestError convenience constructor.
Initializes the
DBRequestErrorwith all the required state for representing a Rate Limit error.Declaration
Objective-C
- (nonnull instancetype) initAsRateLimitError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage structuredRateLimitError: (nonnull DBAUTHRateLimitError *)structuredRateLimitError backoff:(nonnull NSNumber *)backoff;Swift
init(asRateLimitError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?, structuredRateLimitError: DBAUTHRateLimitError, backoff: NSNumber)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
structuredRateLimitErrorThe structured object returned by the Dropbox API in the event of a 429 rate-limit error.
backoffThe number of seconds to wait before making any additional requests in the event of a rate-limit error.
Return Value
An initialized
DBRequestErrorinstance with Rate Limit error state. -
DBRequestErrorconvenience constructor.Initializes the
DBRequestErrorwith all the required state for representing an Internal Server error.Declaration
Objective-C
- (nonnull instancetype) initAsInternalServerError:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage;Swift
init(asInternalServerError requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse.
userMessageAn error message object that is optionally returned from some API endpoints. route-specific error, this field will be the value of the “error_summary” key.
Return Value
An initialized
DBRequestErrorinstance with Internal Server error state. -
DBRequestErrorconvenience constructor.Initializes the
DBRequestErrorwith all the required state for representing an “OS” error. An example of such an error might be if you attempt to make a request and are not connected to the internet.Declaration
Objective-C
- (nonnull instancetype)initAsClientError:(nullable NSError *)nsError;Swift
init(asClientError nsError: Error?)Parameters
nsErrorThe client-side
NSErrorobject returned from the failed response.Return Value
An initialized
DBRequestErrorinstance with Client error state. -
-init:requestId: statusCode: errorContent: userMessage: structuredAuthError: structuredAccessError: structuredPathRootError: structuredRateLimitError: backoff: nsError: DBRequestErrorfull constructor.Declaration
Objective-C
- (nonnull instancetype)init:(DBRequestErrorTag)tag requestId:(nullable NSString *)requestId statusCode:(nullable NSNumber *)statusCode errorContent:(nullable NSString *)errorContent userMessage:(nullable DBLocalizedUserMessage *)userMessage structuredAuthError:(nullable DBAUTHAuthError *)structuredAuthError structuredAccessError:(nullable DBAUTHAccessError *)structuredAccessError structuredPathRootError: (nullable DBCOMMONPathRootError *)structuredPathRootError structuredRateLimitError: (nullable DBAUTHRateLimitError *)structuredRateLimitError backoff:(nullable NSNumber *)backoff nsError:(nullable NSError *)nsError;Swift
init(_ tag: DBRequestErrorTag, requestId: String?, statusCode: NSNumber?, errorContent: String?, userMessage: DBLocalizedUserMessage?, structuredAuthError: DBAUTHAuthError?, structuredAccessError: DBAUTHAccessError?, structuredPathRootError: DBCOMMONPathRootError?, structuredRateLimitError: DBAUTHRateLimitError?, backoff: NSNumber?, nsError: Error?)Parameters
requestIdThe Dropbox request id of the network call. This is useful to Dropbox for debugging issues with Dropbox’s SDKs and API.
statusCodeThe HTTP response status code of the request.
errorContentA string representation of the error body received in the reponse. If for a route-specific error, this field will be the value of the “error_summary” key.
userMessageAn error message object that is optionally returned from some API endpoints.
structuredAuthErrorThe structured object returned by the Dropbox API in the event of a 401 auth error.
structuredAccessErrorThe structured object returned by the Dropbox API in the event of a 403 access error.
structuredPathRootErrorThe structured object returned by the Dropbox API in the event of a 422 path root error.
structuredRateLimitErrorThe structured object returned by the Dropbox API in the event of a 429 rate-limit error.
backoffThe number of seconds to wait before making any additional requests in the event of a rate-limit error.
nsErrorThe client-side NSError object returned from the failed response.
Return Value
An initialized
DBRequestErrorinstance.
-
Retrieves whether the error’s current tag state has value “http_error”.
Declaration
Objective-C
- (BOOL)isHttpError;Swift
func isHttpError() -> BoolReturn Value
Whether the union’s current tag state has value “http_error”.
-
Retrieves whether the error’s current tag state has value “bad_input_error”.
Declaration
Objective-C
- (BOOL)isBadInputError;Swift
func isBadInputError() -> BoolReturn Value
Whether the union’s current tag state has value “bad_input_error”.
-
Retrieves whether the error’s current tag state has value “auth_error”.
Declaration
Objective-C
- (BOOL)isAuthError;Swift
func isAuthError() -> BoolReturn Value
Whether the union’s current tag state has value “auth_error”.
-
Retrieves whether the error’s current tag state has value “access_error”.
Declaration
Objective-C
- (BOOL)isAccessError;Swift
func isAccessError() -> BoolReturn Value
Whether the union’s current tag state has value “access_error”.
-
Retrieves whether the error’s current tag state has value “path_root_error”.
Declaration
Objective-C
- (BOOL)isPathRootError;Swift
func isPathRootError() -> BoolReturn Value
Whether the union’s current tag state has value “path_root_error”.
-
Retrieves whether the error’s current tag state has value “rate_limit_error”.
Declaration
Objective-C
- (BOOL)isRateLimitError;Swift
func isRateLimitError() -> BoolReturn Value
Whether the union’s current tag state has value “rate_limit_error”.
-
Retrieves whether the error’s current tag state has value “internal_server_error”.
Declaration
Objective-C
- (BOOL)isInternalServerError;Swift
func isInternalServerError() -> BoolReturn Value
Whether the union’s current tag state has value “internal_server_error”.
-
Retrieves whether the error’s current tag state has value “client_error”.
Declaration
Objective-C
- (BOOL)isClientError;Swift
func isClientError() -> BoolReturn Value
Whether the union’s current tag state has value “client_error”.
-
Creates a
DBRequestHttpErrorinstance based on the data in the currentDBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “http_error”. Should only use after checking ifisHttpErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestHttpError *)asHttpError;Swift
func asHttpError() -> DBRequestHttpErrorReturn Value
An initialized
DBRequestHttpErrorinstance. -
Creates a
DBRequestBadInputErrorinstance based on the data in the currentDBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “bad_input_error”. Should only use after checking ifisBadInputErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestBadInputError *)asBadInputError;Swift
func asBadInputError() -> DBRequestBadInputErrorReturn Value
An initialized
DBRequestBadInputError. -
Creates a DBRequestAuthError instance based on the data in the current
DBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “auth_error”. Should only use after checking ifisAuthErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestAuthError *)asAuthError;Swift
func asAuthError() -> DBRequestAuthErrorReturn Value
An initialized
DBRequestAuthErrorinstance. -
Creates a DBRequestAccessError instance based on the data in the current
DBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “auth_error”. Should only use after checking ifisAccessErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestAccessError *)asAccessError;Swift
func asAccessError() -> DBRequestAccessErrorReturn Value
An initialized
DBRequestAccessErrorinstance. -
Creates a DBRequestAccessError instance based on the data in the current
DBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “auth_error”. Should only use after checking ifisAccessErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestPathRootError *)asPathRootError;Swift
func asPathRootError() -> DBRequestPathRootErrorReturn Value
An initialized
DBRequestAccessErrorinstance. -
Creates a
DBRequestRateLimitErrorinstance based on the data in the currentDBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “rate_limit_error”. Should only use after checking ifisRateLimitErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestRateLimitError *)asRateLimitError;Swift
func asRateLimitError() -> DBRequestRateLimitErrorReturn Value
An initialized
DBRequestRateLimitErrorinstance. -
Creates a
DBRequestInternalServerErrorinstance based on the data in the currentDBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “internal_server_error”. Should only use after checking ifisInternalServerErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestInternalServerError *)asInternalServerError;Swift
func asInternalServerError() -> DBRequestInternalServerErrorReturn Value
An initialized
DBHttpErrorinstance. -
Creates a
DBRequestClientErrorinstance based on the data in the currentDBRequestErrorinstance.Note
Will throw error if current
DBRequestErrorinstance tag state is not “client_error”. Should only use after checking ifisClientErrorreturns true for the currentDBRequestErrorinstance.Declaration
Objective-C
- (nonnull DBRequestClientError *)asClientError;Swift
func asClientError() -> DBRequestClientErrorReturn Value
An initialized
DBRequestClientErrorinstance.
-
Retrieves string value of union’s current tag state.
Declaration
Objective-C
- (nonnull NSString *)tagName;Swift
func tagName() -> StringReturn Value
A human-readable string representing the
DBRequestErrorobject’s current tag state.
-
Description method.
Declaration
Objective-C
- (nonnull NSString *)description;Swift
func description() -> StringReturn Value
A human-readable representation of the current
DBRequestErrorobject.
View on GitHub
DBRequestError Class Reference