here is my code api response for error:
guard (error == nil) else {
print("There was an error with your request: \(error)")
return
}
response error:
Optional(Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x7f90d551ce50 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://xxxxx.ie/service/delivery/login, NSErrorFailingURLKey=https://xxxxx.ie/service/delivery/login, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.})
how can get "The request timed out" and code to send user alert.
Note please share, what is best practice what is best practice for error and generate human readable message.
NSErrorhascodeproperty anduserInfodictionary including the localized description. - vadian