From c6dbfd63ad78c634da94d76fb475da5131f5979c Mon Sep 17 00:00:00 2001 From: Marten Rebane Date: Thu, 3 Sep 2026 15:56:45 +0300 Subject: [PATCH] Fix signing error message for Latvia and Lithuania --- .../SmartIdLib/Networking/Handler/ResponseHandler.swift | 2 +- .../Networking/Handler/ResponseHandlerTests.swift | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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))