Alamofire: processing error worldwide
I'm trying to handle Alamofire errors globally, similar to this: AFNetworking: handle the error globally and retry the request
One use case would be to detect an error 400 status code
(unauthorized / expired API marker) and submit a login page. Is there a way to hook something in the Alamofire core or should I create my own error handler and always call it validate().response()
manually every time?
thank
source to share
At the moment, you will have to handle this logic in your own implementation response
. We (TC Alamofire) are currently working on how to facilitate this process, but it is very difficult to get the right one without complicating the rest of the APIs. We are still on the sidelines.
With that said, I built an OAuth 2.0 system that handles this process in another non-open source library. It might just be difficult to do. You will need to connect to closure response
for all requests that might 401. See my answer here for a full breakdown on how to do this.
Hope this helps shed some light. Greetings đģ
source to share