diff --git a/Modules/SmartIdLib/Sources/SmartIdLib/Networking/Handler/ResponseHandler.swift b/Modules/SmartIdLib/Sources/SmartIdLib/Networking/Handler/ResponseHandler.swift index 3ea5f91e..338152c6 100644 --- a/Modules/SmartIdLib/Sources/SmartIdLib/Networking/Handler/ResponseHandler.swift +++ b/Modules/SmartIdLib/Sources/SmartIdLib/Networking/Handler/ResponseHandler.swift @@ -82,7 +82,7 @@ struct ResponseHandler: ResponseHandlerProtocol { switch statusCode ?? -1 { case 400: throw SmartIdError.incorrectParameters - case 401: + case 401, 403: throw SmartIdError.invalidAccessRights case 404: throw SmartIdError.accountNotFound diff --git a/Modules/SmartIdLib/Tests/SmartIdLibTests/Networking/Handler/ResponseHandlerTests.swift b/Modules/SmartIdLib/Tests/SmartIdLibTests/Networking/Handler/ResponseHandlerTests.swift index fc5784a6..8f91650b 100644 --- a/Modules/SmartIdLib/Tests/SmartIdLibTests/Networking/Handler/ResponseHandlerTests.swift +++ b/Modules/SmartIdLib/Tests/SmartIdLibTests/Networking/Handler/ResponseHandlerTests.swift @@ -188,6 +188,15 @@ struct ResponseHandlerTests { } } + @Test + func handleNetworkError_throwsInvalidAccessRightsWhenUnacceptableStatusCode403Returned() { + let afError = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 403)) + + #expect(throws: SmartIdError.invalidAccessRights) { + try handler.handleNetworkError(afError, statusCode: 403) + } + } + @Test func handleNetworkError_throwsIncorrectParametersWhenUnacceptableStatusCode400Returned() { let afError = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 400))