ios - AFHTTPResponseSerializer subclass not calling error handler when data doesn't validate -
i'm subclassing afhttpresponseserializer
because need validation. i'm overriding these 2 methods:
override func validate(_ response: httpurlresponse?, data: data?) throws { // checking logic throw nserror(....) } override func responseobject(for response: urlresponse?, data: data?, error: nserrorpointer) -> any? { { try validate(response as? httpurlresponse, data: data) } catch let e { return nserror(...) } } // later in code manager.post(url, parameters: params, ...)
i put break points in these 2 functions , saw error thrown in validate
function , nserror
returned in responseobject
, looks never triggers error handler post
method. trigger success handler. why this?
Comments
Post a Comment