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 -1
View File
@@ -168,7 +168,7 @@ abstract class BaseController extends GetxController
} else if (PlatformInfo.isMobile) {
handleUrgentExceptionOnMobile(failure: failure, exception: exception);
} else {
throw NoSupportPlatformException();
throw const NoSupportPlatformException();
}
}
@@ -1 +1,8 @@
class NotFoundDataWithThisKeyException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundDataWithThisKeyException extends AppBaseException {
NotFoundDataWithThisKeyException([super.message]);
@override
String get exceptionName => 'NotFoundDataWithThisKeyException';
}
@@ -1,3 +1,15 @@
class SendingEmailCanceledException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class SavingEmailToDraftsCanceledException implements Exception {}
class SendingEmailCanceledException extends AppBaseException {
SendingEmailCanceledException([super.message]);
@override
String get exceptionName => 'SendingEmailCanceledException';
}
class SavingEmailToDraftsCanceledException extends AppBaseException {
SavingEmailToDraftsCanceledException([super.message]);
@override
String get exceptionName => 'SavingEmailToDraftsCanceledException';
}
@@ -1,10 +1,12 @@
import 'package:jmap_dart_client/jmap/core/error/set_error.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class SetMethodException implements Exception {
class SetMethodException extends AppBaseException {
final Map<Id, SetError> mapErrors;
SetMethodException(this.mapErrors);
}
SetMethodException(this.mapErrors) : super('Errors: $mapErrors');
@override
String get exceptionName => 'SetMethodException';
}
@@ -1,5 +1,22 @@
class DownloadAttachmentInteractorIsNull implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class CapabilityDownloadAllNotSupportedException implements Exception {}
class DownloadAttachmentInteractorIsNull extends AppBaseException {
DownloadAttachmentInteractorIsNull([super.message]);
class DownloadUrlIsNullException implements Exception {}
@override
String get exceptionName => 'DownloadAttachmentInteractorIsNull';
}
class CapabilityDownloadAllNotSupportedException extends AppBaseException {
CapabilityDownloadAllNotSupportedException([super.message]);
@override
String get exceptionName => 'CapabilityDownloadAllNotSupportedException';
}
class DownloadUrlIsNullException extends AppBaseException {
DownloadUrlIsNullException([super.message]);
@override
String get exceptionName => 'DownloadUrlIsNullException';
}
@@ -536,7 +536,7 @@ extension PreviewAttachmentDownloadControllerExtension on DownloadController {
if (!isOpen) {
toastManager.showMessageFailure(
PreviewEmailFromEmlFileFailure(CannotOpenNewWindowException()),
PreviewEmailFromEmlFileFailure(const CannotOpenNewWindowException()),
);
}
} else if (PlatformInfo.isMobile) {
@@ -1,19 +1,48 @@
import 'package:jmap_dart_client/jmap/core/error/set_error.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundCalendarEventException implements Exception {}
class NotFoundCalendarEventException extends AppBaseException {
NotFoundCalendarEventException([super.message]);
class NotParsableCalendarEventException implements Exception {}
@override
String get exceptionName => 'NotFoundCalendarEventException';
}
class NotAcceptableCalendarEventException implements Exception {}
class NotParsableCalendarEventException extends AppBaseException {
NotParsableCalendarEventException([super.message]);
class NotMaybeableCalendarEventException implements Exception {}
@override
String get exceptionName => 'NotParsableCalendarEventException';
}
class NotRejectableCalendarEventException implements Exception {}
class NotAcceptableCalendarEventException extends AppBaseException {
NotAcceptableCalendarEventException([super.message]);
class CannotReplyCalendarEventException implements Exception {
@override
String get exceptionName => 'NotAcceptableCalendarEventException';
}
class NotMaybeableCalendarEventException extends AppBaseException {
NotMaybeableCalendarEventException([super.message]);
@override
String get exceptionName => 'NotMaybeableCalendarEventException';
}
class NotRejectableCalendarEventException extends AppBaseException {
NotRejectableCalendarEventException([super.message]);
@override
String get exceptionName => 'NotRejectableCalendarEventException';
}
class CannotReplyCalendarEventException extends AppBaseException {
final Map<Id, SetError>? mapErrors;
CannotReplyCalendarEventException({this.mapErrors});
}
CannotReplyCalendarEventException({this.mapErrors})
: super(mapErrors != null ? 'Errors: $mapErrors' : null);
@override
String get exceptionName => 'CannotReplyCalendarEventException';
}
@@ -1,8 +1,29 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundStoredOpenedEmailException implements Exception {}
class NotFoundStoredOpenedEmailException extends AppBaseException {
NotFoundStoredOpenedEmailException([super.message]);
class NotFoundStoredNewEmailException implements Exception {}
@override
String get exceptionName => 'NotFoundStoredOpenedEmailException';
}
class NotFoundStoredEmailException implements Exception {}
class NotFoundStoredNewEmailException extends AppBaseException {
NotFoundStoredNewEmailException([super.message]);
class OpenedEmailAlreadyStoredException implements Exception {}
@override
String get exceptionName => 'NotFoundStoredNewEmailException';
}
class NotFoundStoredEmailException extends AppBaseException {
NotFoundStoredEmailException([super.message]);
@override
String get exceptionName => 'NotFoundStoredEmailException';
}
class OpenedEmailAlreadyStoredException extends AppBaseException {
OpenedEmailAlreadyStoredException([super.message]);
@override
String get exceptionName => 'OpenedEmailAlreadyStoredException';
}
@@ -1,27 +1,70 @@
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundEmailException implements Exception {}
class NotFoundEmailException extends AppBaseException {
NotFoundEmailException([super.message]);
class NotFoundEmailContentException implements Exception {}
@override
String get exceptionName => 'NotFoundEmailException';
}
class EmptyEmailContentException implements Exception {}
class NotFoundEmailContentException extends AppBaseException {
NotFoundEmailContentException([super.message]);
class NotFoundEmailRecoveryActionException implements Exception {}
@override
String get exceptionName => 'NotFoundEmailContentException';
}
class NotFoundEmailBlobIdException implements Exception {}
class EmptyEmailContentException extends AppBaseException {
EmptyEmailContentException([super.message]);
class CannotCreateEmailObjectException implements Exception {}
@override
String get exceptionName => 'EmptyEmailContentException';
}
class NotFoundBlobIdException implements Exception {
class NotFoundEmailRecoveryActionException extends AppBaseException {
NotFoundEmailRecoveryActionException([super.message]);
@override
String get exceptionName => 'NotFoundEmailRecoveryActionException';
}
class NotFoundEmailBlobIdException extends AppBaseException {
NotFoundEmailBlobIdException([super.message]);
@override
String get exceptionName => 'NotFoundEmailBlobIdException';
}
class CannotCreateEmailObjectException extends AppBaseException {
CannotCreateEmailObjectException([super.message]);
@override
String get exceptionName => 'CannotCreateEmailObjectException';
}
class NotFoundBlobIdException extends AppBaseException {
final List<Id> ids;
NotFoundBlobIdException(this.ids);
NotFoundBlobIdException(this.ids) : super('Blob IDs: $ids');
@override
String get exceptionName => 'NotFoundBlobIdException';
}
class NotParsableBlobIdToEmailException implements Exception {
class NotParsableBlobIdToEmailException extends AppBaseException {
final List<Id>? ids;
NotParsableBlobIdToEmailException({this.ids});
NotParsableBlobIdToEmailException({this.ids})
: super(ids != null ? 'Blob IDs: $ids' : null);
@override
String get exceptionName => 'NotParsableBlobIdToEmailException';
}
class EmailIdsSuccessIsEmptyException implements Exception {}
class EmailIdsSuccessIsEmptyException extends AppBaseException {
EmailIdsSuccessIsEmptyException([super.message]);
@override
String get exceptionName => 'EmailIdsSuccessIsEmptyException';
}
@@ -1,8 +1,29 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundSessionException implements Exception {}
class NotFoundSessionException extends AppBaseException {
NotFoundSessionException([super.message]);
class NotFoundAccountIdException implements Exception {}
@override
String get exceptionName => 'NotFoundSessionException';
}
class NotFoundContextException implements Exception {}
class NotFoundAccountIdException extends AppBaseException {
NotFoundAccountIdException([super.message]);
class ParametersIsNullException implements Exception {}
@override
String get exceptionName => 'NotFoundAccountIdException';
}
class NotFoundContextException extends AppBaseException {
NotFoundContextException([super.message]);
@override
String get exceptionName => 'NotFoundContextException';
}
class ParametersIsNullException extends AppBaseException {
ParametersIsNullException([super.message]);
@override
String get exceptionName => 'ParametersIsNullException';
}
@@ -46,7 +46,7 @@ class LocalIdentityCreatorDataSourceImpl implements IdentityCreatorDataSource {
if (result != null) {
return IdentityCacheModel.fromJson(jsonDecode(result.value));
} else {
throw NotFoundInWebSessionException();
throw const NotFoundInWebSessionException();
}
}).catchError(_exceptionThrower.throwException);
}
@@ -1,9 +1,15 @@
class LabelKeywordIsNull implements Exception {
import 'package:core/domain/exceptions/app_base_exception.dart';
class LabelKeywordIsNull extends AppBaseException {
LabelKeywordIsNull([super.message = 'Label keyword is null']);
@override
String toString() => 'Label keyword is null';
String get exceptionName => 'LabelKeywordIsNull';
}
class LabelIdIsNull implements Exception {
class LabelIdIsNull extends AppBaseException {
LabelIdIsNull([super.message = 'Label id is null']);
@override
String toString() => 'Label id is null';
String get exceptionName => 'LabelIdIsNull';
}
@@ -86,7 +86,7 @@ extension HandleLabelActionTypeExtension on LabelController {
);
} else if (editLabelInteractor == null) {
consumeState(
Stream.value(Left(EditLabelFailure(InteractorNotInitialized()))),
Stream.value(Left(EditLabelFailure(const InteractorNotInitialized()))),
);
} else {
final labelId = selectedLabel.id;
@@ -159,7 +159,7 @@ extension HandleLabelActionTypeExtension on LabelController {
} else if (deleteALabelInteractor == null) {
emitFailure(
controller: this,
failure: DeleteALabelFailure(InteractorNotInitialized()),
failure: DeleteALabelFailure(const InteractorNotInitialized()),
);
} else {
consumeState(deleteALabelInteractor!.execute(accountId, label));
@@ -146,7 +146,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
log('LabelController::_createNewLabel:Label: $label');
if (_createNewLabelInteractor == null) {
consumeState(
Stream.value(Left(CreateNewLabelFailure(InteractorNotInitialized()))),
Stream.value(Left(CreateNewLabelFailure(const InteractorNotInitialized()))),
);
} else {
consumeState(_createNewLabelInteractor!.execute(accountId, label));
@@ -1,9 +1,36 @@
class CanNotFoundOIDCAuthority implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class CanNotFoundOIDCLinks implements Exception {}
class CanNotFoundOIDCAuthority extends AppBaseException {
CanNotFoundOIDCAuthority([super.message]);
class CanNotFindToken implements Exception {}
@override
String get exceptionName => 'CanNotFoundOIDCAuthority';
}
class CanRetryOIDCException implements Exception {}
class CanNotFoundOIDCLinks extends AppBaseException {
CanNotFoundOIDCLinks([super.message]);
class NotFoundUserInfoEndpointException implements Exception {}
@override
String get exceptionName => 'CanNotFoundOIDCLinks';
}
class CanNotFindToken extends AppBaseException {
CanNotFindToken([super.message]);
@override
String get exceptionName => 'CanNotFindToken';
}
class CanRetryOIDCException extends AppBaseException {
CanRetryOIDCException([super.message]);
@override
String get exceptionName => 'CanRetryOIDCException';
}
class NotFoundUserInfoEndpointException extends AppBaseException {
NotFoundUserInfoEndpointException([super.message]);
@override
String get exceptionName => 'NotFoundUserInfoEndpointException';
}
@@ -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';
}
@@ -1,16 +1,35 @@
import 'package:flutter/services.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundDataResourceRecordException implements Exception {}
class NotFoundDataResourceRecordException extends AppBaseException {
NotFoundDataResourceRecordException([super.message]);
class NotFoundUrlException implements Exception {}
@override
String get exceptionName => 'NotFoundDataResourceRecordException';
}
class InvalidOIDCResponseException implements Exception {}
class NotFoundUrlException extends AppBaseException {
NotFoundUrlException([super.message]);
class NoSuitableBrowserForOIDCException implements Exception {
@override
String get exceptionName => 'NotFoundUrlException';
}
class InvalidOIDCResponseException extends AppBaseException {
InvalidOIDCResponseException([super.message]);
@override
String get exceptionName => 'InvalidOIDCResponseException';
}
class NoSuitableBrowserForOIDCException extends AppBaseException {
static const noBrowserAvailableCode = 'no_browser_available';
NoSuitableBrowserForOIDCException([super.message]);
@override
String get exceptionName => 'NoSuitableBrowserForOIDCException';
static bool verifyException(dynamic exception) {
if (exception is PlatformException) {
if (exception.code == noBrowserAvailableCode) {
@@ -21,5 +40,9 @@ class NoSuitableBrowserForOIDCException implements Exception {
}
}
class NotFoundCompanyServerLoginInfoException implements Exception {}
class NotFoundCompanyServerLoginInfoException extends AppBaseException {
NotFoundCompanyServerLoginInfoException([super.message]);
@override
String get exceptionName => 'NotFoundCompanyServerLoginInfoException';
}
@@ -1 +1,8 @@
class UserCancelledLogoutOIDCFlowException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class UserCancelledLogoutOIDCFlowException extends AppBaseException {
UserCancelledLogoutOIDCFlowException([super.message]);
@override
String get exceptionName => 'UserCancelledLogoutOIDCFlowException';
}
@@ -1,15 +1,27 @@
class OAuthAuthorizationError {
import 'package:core/domain/exceptions/app_base_exception.dart';
class OAuthAuthorizationError extends AppBaseException {
static const String serverError = 'server_error'; // HTTP 500 error code
static const String temporarilyUnavailable =
'temporarily_unavailable'; // HTTP 503 error code
final String error;
final String? errorDescription;
const OAuthAuthorizationError({
required this.error,
this.errorDescription,
});
String? errorDescription,
}) : super(errorDescription);
@override
String get exceptionName => 'OAuthAuthorizationError';
@override
String toString() {
if (message != null && message!.isNotEmpty) {
return '$exceptionName(code: $error): $message';
}
return '$exceptionName(code: $error)';
}
static OAuthAuthorizationError fromErrorCode(
String error, {
@@ -30,11 +42,23 @@ class OAuthAuthorizationError {
}
class ServerError extends OAuthAuthorizationError {
const ServerError({super.errorDescription})
: super(error: OAuthAuthorizationError.serverError);
const ServerError({String? errorDescription})
: super(
error: OAuthAuthorizationError.serverError,
errorDescription: errorDescription,
);
@override
String get exceptionName => 'ServerError';
}
class TemporarilyUnavailable extends OAuthAuthorizationError {
const TemporarilyUnavailable({super.errorDescription})
: super(error: OAuthAuthorizationError.temporarilyUnavailable);
const TemporarilyUnavailable({String? errorDescription})
: super(
error: OAuthAuthorizationError.temporarilyUnavailable,
errorDescription: errorDescription,
);
@override
String get exceptionName => 'TemporarilyUnavailable';
}
@@ -60,7 +60,7 @@ class MailboxIsolateWorker {
} else {
final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken();
throw const CanNotGetRootIsolateToken();
}
final result = await _isolateExecutor.execute(
@@ -227,7 +227,7 @@ class MailboxIsolateWorker {
}) async {
final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken();
throw const CanNotGetRootIsolateToken();
}
final countEmailsCompleted = await _isolateExecutor.execute(
@@ -1,9 +1,11 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class EmptyFolderNameException implements Exception {
class EmptyFolderNameException extends AppBaseException {
final String folderName;
EmptyFolderNameException(this.folderName);
EmptyFolderNameException(this.folderName)
: super('Folder name should not be empty: $folderName');
@override
String toString() => 'EmptyFolderNameException: Folder name should not be empty: $folderName';
String get exceptionName => 'EmptyFolderNameException';
}
@@ -1,9 +1,10 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class InvalidMailFormatException implements Exception {
class InvalidMailFormatException extends AppBaseException {
final String mail;
InvalidMailFormatException(this.mail);
InvalidMailFormatException(this.mail) : super('Email: $mail');
@override
String toString() => 'InvalidMailFormatException: $mail';
String get exceptionName => 'InvalidMailFormatException';
}
@@ -1,8 +1,29 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundInboxMailboxException implements Exception {}
class NotFoundInboxMailboxException extends AppBaseException {
NotFoundInboxMailboxException([super.message]);
class NotFoundMailboxException implements Exception {}
@override
String get exceptionName => 'NotFoundInboxMailboxException';
}
class NotFoundClearMailboxResponseException implements Exception {}
class NotFoundMailboxException extends AppBaseException {
NotFoundMailboxException([super.message]);
class CannotMoveAllEmailException implements Exception {}
@override
String get exceptionName => 'NotFoundMailboxException';
}
class NotFoundClearMailboxResponseException extends AppBaseException {
NotFoundClearMailboxResponseException([super.message]);
@override
String get exceptionName => 'NotFoundClearMailboxResponseException';
}
class CannotMoveAllEmailException extends AppBaseException {
CannotMoveAllEmailException([super.message]);
@override
String get exceptionName => 'CannotMoveAllEmailException';
}
@@ -1,8 +1,9 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NullSessionOrAccountIdException implements Exception {
NullSessionOrAccountIdException();
class NullSessionOrAccountIdException extends AppBaseException {
NullSessionOrAccountIdException(
[super.message = 'session and accountId should not be null']);
@override
String toString() => 'NullSessionOrAccountIdException: session and accountId should not be null';
String get exceptionName => 'NullSessionOrAccountIdException';
}
@@ -1,3 +1,15 @@
class NotFoundMailboxCreatedException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundMailboxUpdatedRoleException implements Exception {}
class NotFoundMailboxCreatedException extends AppBaseException {
NotFoundMailboxCreatedException([super.message]);
@override
String get exceptionName => 'NotFoundMailboxCreatedException';
}
class NotFoundMailboxUpdatedRoleException extends AppBaseException {
NotFoundMailboxUpdatedRoleException([super.message]);
@override
String get exceptionName => 'NotFoundMailboxUpdatedRoleException';
}
@@ -1,11 +1,20 @@
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class SetMailboxNameException implements Exception {
static const emptyMailboxNameDescription = 'has an empty part within its mailbox name';
static const mailboxNameContainsInvalidCharactersDescription = 'contains one of the forbidden characters';
class SetMailboxNameException extends AppBaseException {
static const emptyMailboxNameDescription =
'has an empty part within its mailbox name';
static const mailboxNameContainsInvalidCharactersDescription =
'contains one of the forbidden characters';
static SetMailboxNameException detectMailboxNameException(Object exception, MailboxId mailboxId) {
SetMailboxNameException([super.message]);
@override
String get exceptionName => 'SetMailboxNameException';
static SetMailboxNameException detectMailboxNameException(
Object exception, MailboxId mailboxId) {
if (exception is SetMethodException) {
final setError = exception.mapErrors[mailboxId.id];
if (setError == null) {
@@ -19,15 +28,30 @@ class SetMailboxNameException implements Exception {
if (errorDescription.contains(emptyMailboxNameDescription)) {
return EmptyMailboxNameException();
} else if (errorDescription.contains(mailboxNameContainsInvalidCharactersDescription)) {
} else if (errorDescription
.contains(mailboxNameContainsInvalidCharactersDescription)) {
return ContainsInvalidCharactersMailboxNameException();
}
return SetMailboxNameException();
return SetMailboxNameException(errorDescription);
}
return SetMailboxNameException();
}
}
class EmptyMailboxNameException implements SetMailboxNameException {}
class EmptyMailboxNameException extends SetMailboxNameException {
EmptyMailboxNameException()
: super(SetMailboxNameException.emptyMailboxNameDescription);
class ContainsInvalidCharactersMailboxNameException implements SetMailboxNameException {}
@override
String get exceptionName => 'EmptyMailboxNameException';
}
class ContainsInvalidCharactersMailboxNameException
extends SetMailboxNameException {
ContainsInvalidCharactersMailboxNameException()
: super(SetMailboxNameException
.mailboxNameContainsInvalidCharactersDescription);
@override
String get exceptionName => 'ContainsInvalidCharactersMailboxNameException';
}
@@ -1,8 +1,9 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class SetMailboxRightsException implements Exception {
SetMailboxRightsException();
class SetMailboxRightsException extends AppBaseException {
SetMailboxRightsException(
[super.message = 'Failed to update mailbox rights.']);
@override
String toString() => 'Failed to update mailbox rights.';
}
String get exceptionName => 'SetMailboxRightsException';
}
@@ -1,37 +1,55 @@
import 'package:equatable/equatable.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
abstract class VerifyNameException extends Equatable implements Exception {
abstract class VerifyNameException extends AppBaseException
with EquatableMixin {
static const emptyName = 'The name cannot be empty!';
static const duplicatedName = 'The name already exists!';
static const nameContainSpecialCharacter = 'The name cannot contain special characters';
static const nameContainSpecialCharacter =
'The name cannot contain special characters';
static const emailAddressInvalid = 'The email address invalid';
static const spaceOnlyWithinName = 'The name cannot contain only spaces';
final String? message;
const VerifyNameException(this.message);
const VerifyNameException(super.message);
@override
List<Object?> get props => [message];
List<Object?> get props => [message, exceptionName];
}
class EmptyNameException extends VerifyNameException {
const EmptyNameException() : super(VerifyNameException.emptyName);
@override
String get exceptionName => 'EmptyNameException';
}
class DuplicatedNameException extends VerifyNameException {
const DuplicatedNameException() : super(VerifyNameException.duplicatedName);
@override
String get exceptionName => 'DuplicatedNameException';
}
class SpecialCharacterException extends VerifyNameException {
const SpecialCharacterException() : super(VerifyNameException.nameContainSpecialCharacter);
const SpecialCharacterException()
: super(VerifyNameException.nameContainSpecialCharacter);
@override
String get exceptionName => 'SpecialCharacterException';
}
class EmailAddressInvalidException extends VerifyNameException {
const EmailAddressInvalidException() : super(VerifyNameException.emailAddressInvalid);
const EmailAddressInvalidException()
: super(VerifyNameException.emailAddressInvalid);
@override
String get exceptionName => 'EmailAddressInvalidException';
}
class NameWithSpaceOnlyException extends VerifyNameException {
const NameWithSpaceOnlyException() : super(VerifyNameException.spaceOnlyWithinName);
}
const NameWithSpaceOnlyException()
: super(VerifyNameException.spaceOnlyWithinName);
@override
String get exceptionName => 'NameWithSpaceOnlyException';
}
@@ -39,7 +39,7 @@ class SessionStorageComposerDatasourceImpl
.map((entry) => ComposerCache.fromJson(jsonDecode(entry.value)))
.toList();
} else {
throw NotFoundInWebSessionException();
throw const NotFoundInWebSessionException();
}
}).catchError(_exceptionThrower.throwException);
}
@@ -1,4 +1,15 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundLinagoraEcosystem implements Exception {}
class NotFoundLinagoraEcosystem extends AppBaseException {
NotFoundLinagoraEcosystem([super.message]);
class NotFoundPaywallUrl implements Exception {}
@override
String get exceptionName => 'NotFoundLinagoraEcosystem';
}
class NotFoundPaywallUrl extends AppBaseException {
NotFoundPaywallUrl([super.message]);
@override
String get exceptionName => 'NotFoundPaywallUrl';
}
@@ -1,6 +1,22 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundLastTimeDismissedSpamReportException implements Exception {}
class NotFoundLastTimeDismissedSpamReportException extends AppBaseException {
NotFoundLastTimeDismissedSpamReportException([super.message]);
class NotFoundSpamMailboxCachedException implements Exception {}
@override
String get exceptionName => 'NotFoundLastTimeDismissedSpamReportException';
}
class NotFoundSpamMailboxException implements Exception {}
class NotFoundSpamMailboxCachedException extends AppBaseException {
NotFoundSpamMailboxCachedException([super.message]);
@override
String get exceptionName => 'NotFoundSpamMailboxCachedException';
}
class NotFoundSpamMailboxException extends AppBaseException {
NotFoundSpamMailboxException([super.message]);
@override
String get exceptionName => 'NotFoundSpamMailboxException';
}
@@ -1,7 +1,29 @@
class NotFoundForwardException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class UpdateForwardException implements Exception {}
class NotFoundForwardException extends AppBaseException {
NotFoundForwardException([super.message]);
class RecipientListIsEmptyException implements Exception {}
@override
String get exceptionName => 'NotFoundForwardException';
}
class RecipientListWithInvalidEmailsException implements Exception {}
class UpdateForwardException extends AppBaseException {
UpdateForwardException([super.message]);
@override
String get exceptionName => 'UpdateForwardException';
}
class RecipientListIsEmptyException extends AppBaseException {
RecipientListIsEmptyException([super.message]);
@override
String get exceptionName => 'RecipientListIsEmptyException';
}
class RecipientListWithInvalidEmailsException extends AppBaseException {
RecipientListWithInvalidEmailsException([super.message]);
@override
String get exceptionName => 'RecipientListWithInvalidEmailsException';
}
@@ -1,2 +1,8 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class RuleFilterNotBindingException implements Exception {}
class RuleFilterNotBindingException extends AppBaseException {
RuleFilterNotBindingException([super.message]);
@override
String get exceptionName => 'RuleFilterNotBindingException';
}
@@ -1,17 +1,29 @@
class CannotCreatePublicAssetException implements Exception {
const CannotCreatePublicAssetException();
import 'package:core/domain/exceptions/app_base_exception.dart';
class CannotCreatePublicAssetException extends AppBaseException {
const CannotCreatePublicAssetException([super.message]);
@override
String get exceptionName => 'CannotCreatePublicAssetException';
}
class PublicAssetQuotaExceededException implements Exception {
const PublicAssetQuotaExceededException({required this.message});
class PublicAssetQuotaExceededException extends AppBaseException {
const PublicAssetQuotaExceededException({String? message}) : super(message);
final String? message;
@override
String get exceptionName => 'PublicAssetQuotaExceededException';
}
class CannotDestroyPublicAssetException implements Exception {
const CannotDestroyPublicAssetException();
class CannotDestroyPublicAssetException extends AppBaseException {
const CannotDestroyPublicAssetException([super.message]);
@override
String get exceptionName => 'CannotDestroyPublicAssetException';
}
class CannotUpdatePublicAssetException implements Exception {
const CannotUpdatePublicAssetException();
}
class CannotUpdatePublicAssetException extends AppBaseException {
const CannotUpdatePublicAssetException([super.message]);
@override
String get exceptionName => 'CannotUpdatePublicAssetException';
}
@@ -1,23 +1,85 @@
class NotSupportFCMException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotLoadedFCMTokenException implements Exception {}
class NotSupportFCMException extends AppBaseException {
NotSupportFCMException([super.message]);
class NotFoundStateToRefreshException implements Exception {}
@override
String get exceptionName => 'NotSupportFCMException';
}
class NotFoundEmailDeliveryStateException implements Exception {}
class NotLoadedFCMTokenException extends AppBaseException {
NotLoadedFCMTokenException([super.message]);
class NotFoundFirebaseRegistrationForDeviceException implements Exception {}
@override
String get exceptionName => 'NotLoadedFCMTokenException';
}
class NotFoundFirebaseRegistrationCacheException implements Exception {}
class NotFoundStateToRefreshException extends AppBaseException {
NotFoundStateToRefreshException([super.message]);
class NotFoundEmailStateException implements Exception {}
@override
String get exceptionName => 'NotFoundStateToRefreshException';
}
class NotFoundNewReceiveEmailException implements Exception {}
class NotFoundEmailDeliveryStateException extends AppBaseException {
NotFoundEmailDeliveryStateException([super.message]);
class EmailStateNoChangeException implements Exception {}
@override
String get exceptionName => 'NotFoundEmailDeliveryStateException';
}
class NotFoundFirebaseRegistrationCreatedException implements Exception {}
class NotFoundFirebaseRegistrationForDeviceException extends AppBaseException {
NotFoundFirebaseRegistrationForDeviceException([super.message]);
class NotFoundFirebaseRegistrationUpdatedException implements Exception {}
@override
String get exceptionName => 'NotFoundFirebaseRegistrationForDeviceException';
}
class NotFoundFirebaseRegistrationDestroyedException implements Exception {}
class NotFoundFirebaseRegistrationCacheException extends AppBaseException {
NotFoundFirebaseRegistrationCacheException([super.message]);
@override
String get exceptionName => 'NotFoundFirebaseRegistrationCacheException';
}
class NotFoundEmailStateException extends AppBaseException {
NotFoundEmailStateException([super.message]);
@override
String get exceptionName => 'NotFoundEmailStateException';
}
class NotFoundNewReceiveEmailException extends AppBaseException {
NotFoundNewReceiveEmailException([super.message]);
@override
String get exceptionName => 'NotFoundNewReceiveEmailException';
}
class EmailStateNoChangeException extends AppBaseException {
EmailStateNoChangeException([super.message]);
@override
String get exceptionName => 'EmailStateNoChangeException';
}
class NotFoundFirebaseRegistrationCreatedException extends AppBaseException {
NotFoundFirebaseRegistrationCreatedException([super.message]);
@override
String get exceptionName => 'NotFoundFirebaseRegistrationCreatedException';
}
class NotFoundFirebaseRegistrationUpdatedException extends AppBaseException {
NotFoundFirebaseRegistrationUpdatedException([super.message]);
@override
String get exceptionName => 'NotFoundFirebaseRegistrationUpdatedException';
}
class NotFoundFirebaseRegistrationDestroyedException extends AppBaseException {
NotFoundFirebaseRegistrationDestroyedException([super.message]);
@override
String get exceptionName => 'NotFoundFirebaseRegistrationDestroyedException';
}
@@ -1,7 +1,29 @@
class WebSocketPushNotSupportedException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class WebSocketUriUnavailableException implements Exception {}
class WebSocketPushNotSupportedException extends AppBaseException {
WebSocketPushNotSupportedException([super.message]);
class WebSocketTicketUnavailableException implements Exception {}
@override
String get exceptionName => 'WebSocketPushNotSupportedException';
}
class WebSocketClosedException implements Exception {}
class WebSocketUriUnavailableException extends AppBaseException {
WebSocketUriUnavailableException([super.message]);
@override
String get exceptionName => 'WebSocketUriUnavailableException';
}
class WebSocketTicketUnavailableException extends AppBaseException {
WebSocketTicketUnavailableException([super.message]);
@override
String get exceptionName => 'WebSocketTicketUnavailableException';
}
class WebSocketClosedException extends AppBaseException {
WebSocketClosedException([super.message]);
@override
String get exceptionName => 'WebSocketClosedException';
}
@@ -1,3 +1,15 @@
class NotFoundQuotasException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class QuotasNotSupportedException implements Exception {}
class NotFoundQuotasException extends AppBaseException {
NotFoundQuotasException([super.message]);
@override
String get exceptionName => 'NotFoundQuotasException';
}
class QuotasNotSupportedException extends AppBaseException {
QuotasNotSupportedException([super.message]);
@override
String get exceptionName => 'QuotasNotSupportedException';
}
@@ -1,4 +1,15 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundSendingEmailHiveObject implements Exception {}
class NotFoundSendingEmailHiveObject extends AppBaseException {
NotFoundSendingEmailHiveObject([super.message]);
class ExistSendingEmailHiveObject implements Exception {}
@override
String get exceptionName => 'NotFoundSendingEmailHiveObject';
}
class ExistSendingEmailHiveObject extends AppBaseException {
ExistSendingEmailHiveObject([super.message]);
@override
String get exceptionName => 'ExistSendingEmailHiveObject';
}
@@ -1,5 +1,22 @@
class NotFoundServerSettingsException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundSettingOptionException implements Exception {}
class NotFoundServerSettingsException extends AppBaseException {
NotFoundServerSettingsException([super.message]);
class CanNotUpdateServerSettingsException implements Exception {}
@override
String get exceptionName => 'NotFoundServerSettingsException';
}
class NotFoundSettingOptionException extends AppBaseException {
NotFoundSettingOptionException([super.message]);
@override
String get exceptionName => 'NotFoundSettingOptionException';
}
class CanNotUpdateServerSettingsException extends AppBaseException {
CanNotUpdateServerSettingsException([super.message]);
@override
String get exceptionName => 'CanNotUpdateServerSettingsException';
}
@@ -46,7 +46,7 @@ class ThreadIsolateWorker {
} else {
final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken();
throw const CanNotGetRootIsolateToken();
}
final result = await _isolateExecutor.execute(
@@ -1,3 +1,15 @@
class NotFoundEmailsDeletedException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class InteractorIsNullException implements Exception {}
class NotFoundEmailsDeletedException extends AppBaseException {
NotFoundEmailsDeletedException([super.message]);
@override
String get exceptionName => 'NotFoundEmailsDeletedException';
}
class InteractorIsNullException extends AppBaseException {
InteractorIsNullException([super.message]);
@override
String get exceptionName => 'InteractorIsNullException';
}
@@ -1 +1,8 @@
class EmptyThreadDetailException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class EmptyThreadDetailException extends AppBaseException {
EmptyThreadDetailException([super.message]);
@override
String get exceptionName => 'EmptyThreadDetailException';
}
@@ -1 +1,8 @@
class ThreadDetailOverloadException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class ThreadDetailOverloadException extends AppBaseException {
ThreadDetailOverloadException([super.message]);
@override
String get exceptionName => 'ThreadDetailOverloadException';
}
@@ -60,7 +60,7 @@ class FileUploader {
} else {
final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken();
throw const CanNotGetRootIsolateToken();
}
return await _isolateExecutor.execute(
@@ -1 +1,8 @@
class PickFileCanceledException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class PickFileCanceledException extends AppBaseException {
PickFileCanceledException([super.message]);
@override
String get exceptionName => 'PickFileCanceledException';
}
@@ -1 +1,8 @@
class DataResponseIsNullException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class DataResponseIsNullException extends AppBaseException {
DataResponseIsNullException([super.message]);
@override
String get exceptionName => 'DataResponseIsNullException';
}