In Swift error handling - how do you know what error type is being thrown without looking at the implementation and how do you handle the case where ErrorType-derived error and NSError can be thrown by the method?
e.g.
Code does not show what type of error will be thrown.
public func decode(jwt: String) throws -> JWT {
return try DecodedJWT(jwt: jwt)
}
You can catch the thrown error to a variable and do runtime analysis of the variable. E.g., for some unknown implementation:
Investigate the error as: