DBGlobalErrorResponseHandler
Objective-C
@interface DBGlobalErrorResponseHandler : NSObject
                Swift
class DBGlobalErrorResponseHandler : NSObject
                Allows for consistent, global handling of route-specific error types, as well as general network errors.
Normally, error handling is done on a request-by-request basis, in the supplied response handler. However, it is
convenient to handle some error behavior consistently, regardless of the request or the endpoint. An example of this
might be implementing retry logic for all rate-limiting errors, regardless of their source. For implementing global
error handling for general networking errors like rate-limiting, one of the registerNetworkErrorResponseBlock:
methods should be used. For implementing global error handling for route-specific errors, one of the
registerRouteErrorResponseBlock: methods should be used.
For the route-specific error handling, you may supply either the direct route error type, or any type that the route error type contains as an instance field (or an instance field of an instance field, and so on).
Note
These globally supplied response handlers will be executed in place of the original request-specific response handler. At most one global response handler will be executed, with the prioirty going to the general network response handler, followed by the handler that is associated directly with the route’s error response type, followed by the handler associated with the first matching instance field.- 
                  
                  
Convenience method for registering a global error handler for a specific route error type.
Declaration
Objective-C
+ (void)registerRouteErrorResponseBlock: (nonnull DBRouteErrorResponseBlock)routeErrorResponseBlock routeErrorType:(nonnull Class)routeErrorType;Swift
class func registerRouteErrorResponseBlock(_ routeErrorResponseBlock: @escaping DBRouteErrorResponseBlock, routeErrorType: AnyClass)Parameters
routeErrorResponseBlockThe response block for globally handling the route error.
routeErrorTypeThe error type with which to associate the supplied response block. Note, this method searches the route error type’s instance fields recursively, so this error type may potentially match not only the route error type, but any of its instance fields, and its instance fields’ instance fields, and so on.
 - 
                  
                  
Registers a global error handler for a specific route error type.
Declaration
Objective-C
+ (void)registerRouteErrorResponseBlock: (nonnull DBRouteErrorResponseBlock)routeErrorResponseBlock routeErrorType:(nonnull Class)routeErrorType queue:(nullable NSOperationQueue *)queue;Swift
class func registerRouteErrorResponseBlock(_ routeErrorResponseBlock: @escaping DBRouteErrorResponseBlock, routeErrorType: AnyClass, queue: OperationQueue?)Parameters
routeErrorResponseBlockThe response block for globally handling the route error.
routeErrorTypeThe error type with which to associate the supplied response block. Note, this method searches the route error type’s instance fields recursively, so this error type may potentially match not only the route error type, but any of its instance fields, and its instance fields’ instance fields, and so on.
queueThe operation queue on which to execute the supplied global response handler.
 - 
                  
                  
Removes the global error handler associated with the supplied error type.
routeErrorType The associated error type of the response handler to be removed.
Declaration
Objective-C
+ (void)removeRouteErrorResponseBlockWithRouteErrorType: (nonnull Class)routeErrorType;Swift
class func removeRouteErrorResponseBlock(withRouteErrorType routeErrorType: AnyClass) - 
                  
                  
Convenience method for registering a single global error handler for handling general network errors.
Note
Only one block at a time may be set for handling all general network errors.
Declaration
Objective-C
+ (void)registerNetworkErrorResponseBlock: (nonnull DBNetworkErrorResponseBlock)networkErrorResponseBlock;Swift
class func registerNetworkErrorResponseBlock(_ networkErrorResponseBlock: @escaping DBNetworkErrorResponseBlock)Parameters
networkErrorResponseBlockThe response block for globally handling network errors.
 - 
                  
                  
Registers a single global error handler for handling general network errors.
Note
Only one block at a time may be set for handling all general network errors.
Declaration
Objective-C
+ (void)registerNetworkErrorResponseBlock: (nonnull DBNetworkErrorResponseBlock)networkErrorResponseBlock queue:(nullable NSOperationQueue *)queue;Swift
class func registerNetworkErrorResponseBlock(_ networkErrorResponseBlock: @escaping DBNetworkErrorResponseBlock, queue: OperationQueue?)Parameters
networkErrorResponseBlockThe response block for globally handling network errors.
queueThe operation queue on which to execute the supplied global response handler.
 - 
                  
                  
Removes the single global error handler for general network errors.
Declaration
Objective-C
+ (void)removeNetworkErrorResponseBlock;Swift
class func removeNetworkErrorResponseBlock() 
View on GitHub
        DBGlobalErrorResponseHandler Class Reference