refactor(sentry): standardize exceptions to prevent Sentry minification

This commit is contained in:
dab246
2026-02-24 15:40:07 +07:00
committed by Dat H. Pham
parent 296548a781
commit 2e8a11e7eb
75 changed files with 1128 additions and 309 deletions
@@ -1,4 +1,4 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:tmail_ui_user/main/exceptions/remote_exception.dart';
abstract class AuthenticationException extends RemoteException {
@@ -11,37 +11,94 @@ abstract class AuthenticationException extends RemoteException {
class BadCredentials extends AuthenticationException {
BadCredentials() : super(AuthenticationException.wrongCredential);
@override
String get exceptionName => 'BadCredentials';
}
class BadGateway extends AuthenticationException {
BadGateway() : super(AuthenticationException.badGateway);
@override
String get exceptionName => 'BadGateway';
}
class NotFoundAuthenticatedAccountException implements Exception {}
class NotFoundStoredTokenException implements Exception {}
class InvalidBaseUrl extends AuthenticationException {
InvalidBaseUrl() : super(AuthenticationException.invalidBaseUrl);
@override
String get exceptionName => 'InvalidBaseUrl';
}
class AccessTokenInvalidException implements Exception {}
class NotFoundAuthenticatedAccountException extends AppBaseException {
NotFoundAuthenticatedAccountException([super.message]);
class DownloadAttachmentHasTokenExpiredException implements Exception {
@override
String get exceptionName => 'NotFoundAuthenticatedAccountException';
}
class NotFoundStoredTokenException extends AppBaseException {
NotFoundStoredTokenException([super.message]);
@override
String get exceptionName => 'NotFoundStoredTokenException';
}
class AccessTokenInvalidException extends AppBaseException {
AccessTokenInvalidException([super.message]);
@override
String get exceptionName => 'AccessTokenInvalidException';
}
class DownloadAttachmentHasTokenExpiredException extends AppBaseException {
final String refreshToken;
DownloadAttachmentHasTokenExpiredException(this.refreshToken);
DownloadAttachmentHasTokenExpiredException(this.refreshToken)
: super('Token expired for refresh token: $refreshToken');
@override
String get exceptionName => 'DownloadAttachmentHasTokenExpiredException';
}
class CanNotFoundBaseUrl implements Exception {}
class CanNotFoundBaseUrl extends AppBaseException {
CanNotFoundBaseUrl([super.message]);
class CanNotFoundUserName implements Exception {}
@override
String get exceptionName => 'CanNotFoundBaseUrl';
}
class CanNotFoundPassword implements Exception {}
class CanNotFoundUserName extends AppBaseException {
CanNotFoundUserName([super.message]);
class NotFoundAuthenticationInfoCache implements Exception {}
@override
String get exceptionName => 'CanNotFoundUserName';
}
class CanNotFoundSaasServerUrl implements Exception {}
class CanNotFoundPassword extends AppBaseException {
CanNotFoundPassword([super.message]);
class SaasServerUriIsNull implements Exception {}
@override
String get exceptionName => 'CanNotFoundPassword';
}
class NotFoundAuthenticationInfoCache extends AppBaseException {
NotFoundAuthenticationInfoCache([super.message]);
@override
String get exceptionName => 'NotFoundAuthenticationInfoCache';
}
class CanNotFoundSaasServerUrl extends AppBaseException {
CanNotFoundSaasServerUrl([super.message]);
@override
String get exceptionName => 'CanNotFoundSaasServerUrl';
}
class SaasServerUriIsNull extends AppBaseException {
SaasServerUriIsNull([super.message]);
@override
String get exceptionName => 'SaasServerUriIsNull';
}