fix(import): enhance error handling with localized messages for unauthorized and forbidden responses

This commit is contained in:
Nils-Johan Gynther
2026-04-22 21:33:03 +02:00
parent 81117fbcb7
commit 856efcfa79
@@ -96,10 +96,16 @@ class ImportRepository {
'Import misslyckades (${response.statusCode}).'; 'Import misslyckades (${response.statusCode}).';
if (response.statusCode == 401) { if (response.statusCode == 401) {
throw ApiException(type: ApiErrorType.unauthorized, statusCode: 401); throw ApiException(
type: ApiErrorType.unauthorized,
statusCode: 401,
message: 'Inte inloggad.');
} }
if (response.statusCode == 403) { if (response.statusCode == 403) {
throw ApiException(type: ApiErrorType.forbidden, statusCode: 403); throw ApiException(
type: ApiErrorType.forbidden,
statusCode: 403,
message: 'Åtkomst nekad.');
} }
if (response.statusCode >= 500) { if (response.statusCode >= 500) {
throw ApiException( throw ApiException(