[英]How to determine AFError from NSError domain and code
I collected a large amount of errors, however they are logged by conversion to NSError
domain and code我收集了大量错误,但是它们是通过转换为
NSError
域和代码来记录的
having these information拥有这些信息
Domain: Alamofire.AFError
Code: 8
how to determine the error如何确定错误
https://github.com/Alamofire/Alamofire/blob/master/Source/AFError.swift https://github.com/Alamofire/Alamofire/blob/master/Source/AFError.swift
Conversion to NSError
is a Swift implementation detail, so there's no guaranteed behavior.转换为
NSError
是 Swift 实现细节,因此没有保证行为。 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
.根据该逻辑,代码 8 将是
requestRetryFailed
。 But that determination may change based on Swift version.但该决定可能会根据 Swift 版本而改变。 Best to fix your error logging.
最好修复您的错误记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.