fix(import): enhance error handling with localized messages for unauthorized and forbidden responses
This commit is contained in:
@@ -96,10 +96,16 @@ class ImportRepository {
|
||||
'Import misslyckades (${response.statusCode}).';
|
||||
|
||||
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) {
|
||||
throw ApiException(type: ApiErrorType.forbidden, statusCode: 403);
|
||||
throw ApiException(
|
||||
type: ApiErrorType.forbidden,
|
||||
statusCode: 403,
|
||||
message: 'Åtkomst nekad.');
|
||||
}
|
||||
if (response.statusCode >= 500) {
|
||||
throw ApiException(
|
||||
|
||||
Reference in New Issue
Block a user