Skip to content

Commit 43ccdcd

Browse files
committed
fix(auth): improve error message formatting
- Removed toString() from exception messages - Fixed const exception usage
1 parent 6e8b893 commit 43ccdcd

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/src/services/auth_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class AuthService {
282282
'Error during initiateLinkEmailProcess for user ${anonymousUser.id}, email $emailToLink: $e',
283283
);
284284
throw OperationFailedException(
285-
'Failed to initiate email linking process: ${e.toString()}',
285+
'Failed to initiate email linking process: $e',
286286
);
287287
}
288288
}
@@ -369,7 +369,7 @@ class AuthService {
369369
'Error during completeLinkEmailProcess for user ${anonymousUser.id}: $e',
370370
);
371371
throw OperationFailedException(
372-
'Failed to complete email linking process: ${e.toString()}',
372+
'Failed to complete email linking process: $e',
373373
);
374374
}
375375
}

lib/src/services/verification_code_storage_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class InMemoryVerificationCodeStorageService
220220
userId,
221221
);
222222
if (isEmailPendingForOther) {
223-
throw ConflictException(
223+
throw const ConflictException(
224224
'Email is already pending verification for another account linking process.',
225225
);
226226
}

routes/api/v1/auth/link-email.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Future<Response> onRequest(RequestContext context) async {
7777
'Unexpected error in /link-email handler for user ${authenticatedUser.id}: $e',
7878
);
7979
throw OperationFailedException(
80-
'An unexpected error occurred while initiating email linking: ${e.toString()}',
80+
'An unexpected error occurred while initiating email linking: $e',
8181
);
8282
}
8383
}

routes/api/v1/auth/verify-link-email.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Future<Response> onRequest(RequestContext context) async {
105105
'Unexpected error in /verify-link-email handler for user ${authenticatedUser.id}: $e',
106106
);
107107
throw OperationFailedException(
108-
'An unexpected error occurred while verifying email link: ${e.toString()}',
108+
'An unexpected error occurred while verifying email link: $e',
109109
);
110110
}
111111
}

0 commit comments

Comments
 (0)