okta/okta-auth-swift

Throw exceptions on error

nbarbettini opened this issue · 1 comments

If the API returns a 4xx or 5xx status code, the SDK must throw an exception with the error information.

In Swift it is not possible to throw in async calls, but we have error handling. Use func handleError(_ error: OktaError) in AuthenticationClientDelegate

Supported errors:

public enum OktaError: Error {
    case errorBuildingURLRequest
    case connectionError(Error)
    case emptyServerResponse
    case responseSerializationError(Error)
    case serverRespondedWithError(OktaAPIErrorResponse)
    case authenicationStatusNotSupported(AuthStatus)
    case unexpectedResponse
}