How to determine AFError from NSError domain and code

146 Views Asked by At

I collected a large amount of errors, however they are logged by conversion to NSError domain and code

having these information

Domain: Alamofire.AFError
Code: 8

how to determine the error

https://github.com/Alamofire/Alamofire/blob/master/Source/AFError.swift

1

There are 1 best solutions below

0
Jon Shier On

Conversion to NSError is a Swift implementation detail, so there's no guaranteed behavior. You should capture them more accurately. However, if you really need it, the current conversion behavior encodes cases with associated values first, then cases without. According to that logic, code 8 would be requestRetryFailed. But that determination may change based on Swift version. Best to fix your error logging.