TNErrorHandlerProtocol

public protocol TNErrorHandlerProtocol : AnyObject

Use this protocol to create error handlers that can be passed to Configuration instances. Every class that implements this protocol will be used to handle errors when a request is failing.

  • This function is called when a request is failed.

    Declaration

    Swift

    func requestFailed(withResponse response: Data?, error: TNError, request: Request)

    Parameters

    response

    The deserialized error object

    error

    The TNError provided by Terminetwork

    request

    The Request object

  • This function returns a Boolean for whether the requestFailed function will be executed.

    Declaration

    Swift

    func shouldHandleRequestFailure(withResponse response: Data?, error: TNError, request: Request) -> Bool

    Parameters

    response

    The deserialized error object

    error

    The TNError provided by Terminetwork

    request

    The Request object

  • Default initializer

    Declaration

    Swift

    init()