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
View File
@@ -25,6 +25,7 @@ export 'domain/exceptions/download_file_exception.dart';
export 'data/extensions/options_extensions.dart'; export 'data/extensions/options_extensions.dart';
export 'domain/exceptions/web_session_exception.dart'; export 'domain/exceptions/web_session_exception.dart';
export 'domain/exceptions/platform_exception.dart'; export 'domain/exceptions/platform_exception.dart';
export 'domain/exceptions/app_base_exception.dart';
// Utils // Utils
export 'presentation/utils/theme_utils.dart'; export 'presentation/utils/theme_utils.dart';
@@ -1,13 +1,12 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
class AddressException with EquatableMixin implements Exception { class AddressException extends AppBaseException with EquatableMixin {
final String message; const AddressException(super.message);
AddressException(this.message);
@override @override
String toString() => message; String get exceptionName => 'AddressException';
@override @override
List<Object> get props => [message]; List<Object?> get props => [message, exceptionName];
} }
@@ -0,0 +1,15 @@
abstract class AppBaseException implements Exception {
final String? message;
const AppBaseException([this.message]);
@override
String toString() {
if (message != null && message!.isNotEmpty) {
return '$exceptionName: $message';
}
return exceptionName;
}
String get exceptionName;
}
@@ -1,31 +1,32 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
abstract class DownloadFileException with EquatableMixin implements Exception { abstract class DownloadFileException extends AppBaseException
final String message; with EquatableMixin {
const DownloadFileException(super.message);
DownloadFileException(this.message);
@override @override
String toString() => message; List<Object?> get props => [message, exceptionName];
@override
List<Object> get props => [message];
} }
class CommonDownloadFileException extends DownloadFileException { class CommonDownloadFileException extends DownloadFileException {
CommonDownloadFileException(message) : super(message); const CommonDownloadFileException(super.message);
@override @override
List<Object> get props => [message]; String get exceptionName => 'CommonDownloadFileException';
} }
class CancelDownloadFileException extends DownloadFileException { class CancelDownloadFileException extends DownloadFileException {
CancelDownloadFileException(cancelMessage) : super(cancelMessage); const CancelDownloadFileException(super.message);
@override @override
List<Object> get props => [message]; String get exceptionName => 'CancelDownloadFileException';
} }
class DeviceNotSupportedException extends DownloadFileException { class DeviceNotSupportedException extends DownloadFileException {
DeviceNotSupportedException() : super('This device is not supported, please try on Android or iOS'); const DeviceNotSupportedException()
} : super('This device is not supported, please try on Android or iOS');
@override
String get exceptionName => 'DeviceNotSupportedException';
}
+11 -9
View File
@@ -1,21 +1,23 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
abstract class FileException with EquatableMixin implements Exception { abstract class FileException extends AppBaseException with EquatableMixin {
final String message; const FileException(super.message);
FileException(this.message);
@override @override
String toString() => message; List<Object?> get props => [message, exceptionName];
@override
List<Object> get props => [message];
} }
class NotFoundFileInFolderException extends FileException { class NotFoundFileInFolderException extends FileException {
NotFoundFileInFolderException() : super('No files found in the folder'); NotFoundFileInFolderException() : super('No files found in the folder');
@override
String get exceptionName => 'NotFoundFileInFolderException';
} }
class UserCancelShareFileException extends FileException { class UserCancelShareFileException extends FileException {
UserCancelShareFileException() : super('User cancel share file'); UserCancelShareFileException() : super('User cancel share file');
}
@override
String get exceptionName => 'UserCancelShareFileException';
}
@@ -1,14 +1,19 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
class PlatformException with EquatableMixin implements Exception { class PlatformException extends AppBaseException with EquatableMixin {
final String message; const PlatformException(super.message);
PlatformException(this.message);
@override @override
List<Object> get props => [message]; String get exceptionName => 'PlatformException';
@override
List<Object?> get props => [message, exceptionName];
} }
class NoSupportPlatformException extends PlatformException { class NoSupportPlatformException extends PlatformException {
NoSupportPlatformException() : super('This platform is not supported'); const NoSupportPlatformException() : super('This platform is not supported');
}
@override
String get exceptionName => 'NoSupportPlatformException';
}
@@ -1,7 +1,15 @@
class UnsupportedCharsetException implements Exception { import 'package:core/domain/exceptions/app_base_exception.dart';
const UnsupportedCharsetException();
class UnsupportedCharsetException extends AppBaseException {
const UnsupportedCharsetException([super.message]);
@override
String get exceptionName => 'UnsupportedCharsetException';
} }
class NullCharsetException implements Exception { class NullCharsetException extends AppBaseException {
const NullCharsetException(); const NullCharsetException([super.message]);
}
@override
String get exceptionName => 'NullCharsetException';
}
@@ -1,28 +1,44 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
class NotFoundInWebSessionException with EquatableMixin implements Exception { class NotFoundInWebSessionException extends AppBaseException
final String? errorMessage; with EquatableMixin {
const NotFoundInWebSessionException({String? errorMessage})
NotFoundInWebSessionException({this.errorMessage}); : super(errorMessage);
@override @override
List<Object> get props => []; String get exceptionName => 'NotFoundInWebSessionException';
}
class NotMatchInWebSessionException with EquatableMixin implements Exception {
const NotMatchInWebSessionException();
@override @override
List<Object> get props => []; List<Object?> get props => [message, exceptionName];
} }
class SaveToWebSessionFailException with EquatableMixin implements Exception { class NotMatchInWebSessionException extends AppBaseException
final String? errorMessage; with EquatableMixin {
const NotMatchInWebSessionException() : super('Session data does not match');
SaveToWebSessionFailException({this.errorMessage});
@override @override
List<Object> get props => []; String get exceptionName => 'NotMatchInWebSessionException';
@override
List<Object?> get props => [message, exceptionName];
} }
class CannotOpenNewWindowException implements Exception {} class SaveToWebSessionFailException extends AppBaseException
with EquatableMixin {
const SaveToWebSessionFailException({String? errorMessage})
: super(errorMessage);
@override
String get exceptionName => 'SaveToWebSessionFailException';
@override
List<Object?> get props => [message, exceptionName];
}
class CannotOpenNewWindowException extends AppBaseException {
const CannotOpenNewWindowException([super.message]);
@override
String get exceptionName => 'CannotOpenNewWindowException';
}
+1 -1
View File
@@ -39,7 +39,7 @@ class FileUtils {
return fileDirectory; return fileDirectory;
} else { } else {
throw DeviceNotSupportedException(); throw const DeviceNotSupportedException();
} }
} }
+1 -1
View File
@@ -130,7 +130,7 @@ class LogTracking {
return fileDirectory; return fileDirectory;
} else { } else {
throw DeviceNotSupportedException(); throw const DeviceNotSupportedException();
} }
} }
+7 -7
View File
@@ -40,7 +40,7 @@ class MailAddress with EquatableMixin {
address = address.trim(); address = address.trim();
if (address.isEmpty) { if (address.isEmpty) {
throw AddressException('Addresses should not be empty'); throw const AddressException('Addresses should not be empty');
} }
int pos = 0; int pos = 0;
@@ -88,7 +88,7 @@ class MailAddress with EquatableMixin {
if (postChar == '.') { if (postChar == '.') {
var lastChar = address[pos - 1]; var lastChar = address[pos - 1];
if (lastChar == '@' || lastChar == '.') { if (lastChar == '@' || lastChar == '.') {
throw AddressException('Subdomain expected before "." or duplicate "." in "address"'); throw const AddressException('Subdomain expected before "." or duplicate "." in "address"');
} }
domainSB.write('.'); domainSB.write('.');
pos++; pos++;
@@ -113,7 +113,7 @@ class MailAddress with EquatableMixin {
if (localPart.startsWith('.') || if (localPart.startsWith('.') ||
localPart.endsWith('.') || localPart.endsWith('.') ||
_haveDoubleDot(localPart)) { _haveDoubleDot(localPart)) {
throw AddressException('Addresses cannot start end with "." or contain two consecutive dots'); throw const AddressException('Addresses cannot start end with "." or contain two consecutive dots');
} }
domain = _createDomain(domainSB.toString()); domain = _createDomain(domainSB.toString());
@@ -409,7 +409,7 @@ class MailAddress with EquatableMixin {
lastCharDot = false; lastCharDot = false;
} else if (postChar == '.') { } else if (postChar == '.') {
if (pos == 0) { if (pos == 0) {
throw AddressException('Local part must not start with a "."'); throw const AddressException('Local part must not start with a "."');
} }
lpSB.write('.'); lpSB.write('.');
pos++; pos++;
@@ -530,14 +530,14 @@ class MailAddress with EquatableMixin {
String localPartDetails = localPartDetailsSB.toString(); String localPartDetails = localPartDetailsSB.toString();
if (localPartDetails.isEmpty || localPartDetails.trim().isEmpty) { if (localPartDetails.isEmpty || localPartDetails.trim().isEmpty) {
throw AddressException("target mailbox name should not be empty"); throw const AddressException("target mailbox name should not be empty");
} }
if (localPartDetails.startsWith('#')) { if (localPartDetails.startsWith('#')) {
throw AddressException("target mailbox name should not start with #"); throw const AddressException("target mailbox name should not start with #");
} }
final forbiddenChars = RegExp(r'[*\r\n]'); final forbiddenChars = RegExp(r'[*\r\n]');
if (forbiddenChars.hasMatch(localPartDetails)) { if (forbiddenChars.hasMatch(localPartDetails)) {
throw AddressException("target mailbox name should not contain special characters"); throw const AddressException("target mailbox name should not contain special characters");
} }
localPartSB.write(localPartDetails); localPartSB.write(localPartDetails);
@@ -1 +1,8 @@
class NullInboxUnreadCountException implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class NullInboxUnreadCountException extends AppBaseException {
const NullInboxUnreadCountException([super.message]);
@override
String get exceptionName => 'NullInboxUnreadCountException';
}
@@ -1 +1,8 @@
class NullQuotaException implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class NullQuotaException extends AppBaseException {
NullQuotaException([super.message]);
@override
String get exceptionName => 'NullQuotaException';
}
@@ -97,7 +97,7 @@ class MailboxMenuRobot extends CoreRobot {
.toInt(); .toInt();
if (inboxCount == null) { if (inboxCount == null) {
throw NullInboxUnreadCountException(); throw const NullInboxUnreadCountException();
} }
return inboxCount; return inboxCount;
+1 -1
View File
@@ -168,7 +168,7 @@ abstract class BaseController extends GetxController
} else if (PlatformInfo.isMobile) { } else if (PlatformInfo.isMobile) {
handleUrgentExceptionOnMobile(failure: failure, exception: exception); handleUrgentExceptionOnMobile(failure: failure, exception: exception);
} else { } 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/error/set_error.dart';
import 'package:jmap_dart_client/jmap/core/id.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; 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) { if (!isOpen) {
toastManager.showMessageFailure( toastManager.showMessageFailure(
PreviewEmailFromEmlFileFailure(CannotOpenNewWindowException()), PreviewEmailFromEmlFileFailure(const CannotOpenNewWindowException()),
); );
} }
} else if (PlatformInfo.isMobile) { } 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/error/set_error.dart';
import 'package:jmap_dart_client/jmap/core/id.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; 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: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; 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; 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) { if (result != null) {
return IdentityCacheModel.fromJson(jsonDecode(result.value)); return IdentityCacheModel.fromJson(jsonDecode(result.value));
} else { } else {
throw NotFoundInWebSessionException(); throw const NotFoundInWebSessionException();
} }
}).catchError(_exceptionThrower.throwException); }).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 @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 @override
String toString() => 'Label id is null'; String get exceptionName => 'LabelIdIsNull';
} }
@@ -86,7 +86,7 @@ extension HandleLabelActionTypeExtension on LabelController {
); );
} else if (editLabelInteractor == null) { } else if (editLabelInteractor == null) {
consumeState( consumeState(
Stream.value(Left(EditLabelFailure(InteractorNotInitialized()))), Stream.value(Left(EditLabelFailure(const InteractorNotInitialized()))),
); );
} else { } else {
final labelId = selectedLabel.id; final labelId = selectedLabel.id;
@@ -159,7 +159,7 @@ extension HandleLabelActionTypeExtension on LabelController {
} else if (deleteALabelInteractor == null) { } else if (deleteALabelInteractor == null) {
emitFailure( emitFailure(
controller: this, controller: this,
failure: DeleteALabelFailure(InteractorNotInitialized()), failure: DeleteALabelFailure(const InteractorNotInitialized()),
); );
} else { } else {
consumeState(deleteALabelInteractor!.execute(accountId, label)); consumeState(deleteALabelInteractor!.execute(accountId, label));
@@ -146,7 +146,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
log('LabelController::_createNewLabel:Label: $label'); log('LabelController::_createNewLabel:Label: $label');
if (_createNewLabelInteractor == null) { if (_createNewLabelInteractor == null) {
consumeState( consumeState(
Stream.value(Left(CreateNewLabelFailure(InteractorNotInitialized()))), Stream.value(Left(CreateNewLabelFailure(const InteractorNotInitialized()))),
); );
} else { } else {
consumeState(_createNewLabelInteractor!.execute(accountId, label)); 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'; import 'package:tmail_ui_user/main/exceptions/remote_exception.dart';
abstract class AuthenticationException extends RemoteException { abstract class AuthenticationException extends RemoteException {
@@ -11,37 +11,94 @@ abstract class AuthenticationException extends RemoteException {
class BadCredentials extends AuthenticationException { class BadCredentials extends AuthenticationException {
BadCredentials() : super(AuthenticationException.wrongCredential); BadCredentials() : super(AuthenticationException.wrongCredential);
@override
String get exceptionName => 'BadCredentials';
} }
class BadGateway extends AuthenticationException { class BadGateway extends AuthenticationException {
BadGateway() : super(AuthenticationException.badGateway); BadGateway() : super(AuthenticationException.badGateway);
@override
String get exceptionName => 'BadGateway';
} }
class NotFoundAuthenticatedAccountException implements Exception {}
class NotFoundStoredTokenException implements Exception {}
class InvalidBaseUrl extends AuthenticationException { class InvalidBaseUrl extends AuthenticationException {
InvalidBaseUrl() : super(AuthenticationException.invalidBaseUrl); 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; 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: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'; static const noBrowserAvailableCode = 'no_browser_available';
NoSuitableBrowserForOIDCException([super.message]);
@override
String get exceptionName => 'NoSuitableBrowserForOIDCException';
static bool verifyException(dynamic exception) { static bool verifyException(dynamic exception) {
if (exception is PlatformException) { if (exception is PlatformException) {
if (exception.code == noBrowserAvailableCode) { 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 serverError = 'server_error'; // HTTP 500 error code
static const String temporarilyUnavailable = static const String temporarilyUnavailable =
'temporarily_unavailable'; // HTTP 503 error code 'temporarily_unavailable'; // HTTP 503 error code
final String error; final String error;
final String? errorDescription;
const OAuthAuthorizationError({ const OAuthAuthorizationError({
required this.error, 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( static OAuthAuthorizationError fromErrorCode(
String error, { String error, {
@@ -30,11 +42,23 @@ class OAuthAuthorizationError {
} }
class ServerError extends OAuthAuthorizationError { class ServerError extends OAuthAuthorizationError {
const ServerError({super.errorDescription}) const ServerError({String? errorDescription})
: super(error: OAuthAuthorizationError.serverError); : super(
error: OAuthAuthorizationError.serverError,
errorDescription: errorDescription,
);
@override
String get exceptionName => 'ServerError';
} }
class TemporarilyUnavailable extends OAuthAuthorizationError { class TemporarilyUnavailable extends OAuthAuthorizationError {
const TemporarilyUnavailable({super.errorDescription}) const TemporarilyUnavailable({String? errorDescription})
: super(error: OAuthAuthorizationError.temporarilyUnavailable); : super(
error: OAuthAuthorizationError.temporarilyUnavailable,
errorDescription: errorDescription,
);
@override
String get exceptionName => 'TemporarilyUnavailable';
} }
@@ -60,7 +60,7 @@ class MailboxIsolateWorker {
} else { } else {
final rootIsolateToken = RootIsolateToken.instance; final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) { if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken(); throw const CanNotGetRootIsolateToken();
} }
final result = await _isolateExecutor.execute( final result = await _isolateExecutor.execute(
@@ -227,7 +227,7 @@ class MailboxIsolateWorker {
}) async { }) async {
final rootIsolateToken = RootIsolateToken.instance; final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) { if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken(); throw const CanNotGetRootIsolateToken();
} }
final countEmailsCompleted = await _isolateExecutor.execute( 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; final String folderName;
EmptyFolderNameException(this.folderName); EmptyFolderNameException(this.folderName)
: super('Folder name should not be empty: $folderName');
@override @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; final String mail;
InvalidMailFormatException(this.mail); InvalidMailFormatException(this.mail) : super('Email: $mail');
@override @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 { class NullSessionOrAccountIdException extends AppBaseException {
NullSessionOrAccountIdException(
NullSessionOrAccountIdException(); [super.message = 'session and accountId should not be null']);
@override @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:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.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 { class SetMailboxNameException extends AppBaseException {
static const emptyMailboxNameDescription = 'has an empty part within its mailbox name'; static const emptyMailboxNameDescription =
static const mailboxNameContainsInvalidCharactersDescription = 'contains one of the forbidden characters'; '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) { if (exception is SetMethodException) {
final setError = exception.mapErrors[mailboxId.id]; final setError = exception.mapErrors[mailboxId.id];
if (setError == null) { if (setError == null) {
@@ -19,15 +28,30 @@ class SetMailboxNameException implements Exception {
if (errorDescription.contains(emptyMailboxNameDescription)) { if (errorDescription.contains(emptyMailboxNameDescription)) {
return EmptyMailboxNameException(); return EmptyMailboxNameException();
} else if (errorDescription.contains(mailboxNameContainsInvalidCharactersDescription)) { } else if (errorDescription
.contains(mailboxNameContainsInvalidCharactersDescription)) {
return ContainsInvalidCharactersMailboxNameException(); return ContainsInvalidCharactersMailboxNameException();
} }
return SetMailboxNameException(); return SetMailboxNameException(errorDescription);
} }
return SetMailboxNameException(); 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 { class SetMailboxRightsException extends AppBaseException {
SetMailboxRightsException(
SetMailboxRightsException(); [super.message = 'Failed to update mailbox rights.']);
@override @override
String toString() => 'Failed to update mailbox rights.'; String get exceptionName => 'SetMailboxRightsException';
} }
@@ -1,37 +1,55 @@
import 'package:equatable/equatable.dart'; 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 emptyName = 'The name cannot be empty!';
static const duplicatedName = 'The name already exists!'; 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 emailAddressInvalid = 'The email address invalid';
static const spaceOnlyWithinName = 'The name cannot contain only spaces'; static const spaceOnlyWithinName = 'The name cannot contain only spaces';
final String? message; const VerifyNameException(super.message);
const VerifyNameException(this.message);
@override @override
List<Object?> get props => [message]; List<Object?> get props => [message, exceptionName];
} }
class EmptyNameException extends VerifyNameException { class EmptyNameException extends VerifyNameException {
const EmptyNameException() : super(VerifyNameException.emptyName); const EmptyNameException() : super(VerifyNameException.emptyName);
@override
String get exceptionName => 'EmptyNameException';
} }
class DuplicatedNameException extends VerifyNameException { class DuplicatedNameException extends VerifyNameException {
const DuplicatedNameException() : super(VerifyNameException.duplicatedName); const DuplicatedNameException() : super(VerifyNameException.duplicatedName);
@override
String get exceptionName => 'DuplicatedNameException';
} }
class SpecialCharacterException extends VerifyNameException { class SpecialCharacterException extends VerifyNameException {
const SpecialCharacterException() : super(VerifyNameException.nameContainSpecialCharacter); const SpecialCharacterException()
: super(VerifyNameException.nameContainSpecialCharacter);
@override
String get exceptionName => 'SpecialCharacterException';
} }
class EmailAddressInvalidException extends VerifyNameException { class EmailAddressInvalidException extends VerifyNameException {
const EmailAddressInvalidException() : super(VerifyNameException.emailAddressInvalid); const EmailAddressInvalidException()
: super(VerifyNameException.emailAddressInvalid);
@override
String get exceptionName => 'EmailAddressInvalidException';
} }
class NameWithSpaceOnlyException extends VerifyNameException { 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))) .map((entry) => ComposerCache.fromJson(jsonDecode(entry.value)))
.toList(); .toList();
} else { } else {
throw NotFoundInWebSessionException(); throw const NotFoundInWebSessionException();
} }
}).catchError(_exceptionThrower.throwException); }).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 { import 'package:core/domain/exceptions/app_base_exception.dart';
const CannotCreatePublicAssetException();
class CannotCreatePublicAssetException extends AppBaseException {
const CannotCreatePublicAssetException([super.message]);
@override
String get exceptionName => 'CannotCreatePublicAssetException';
} }
class PublicAssetQuotaExceededException implements Exception { class PublicAssetQuotaExceededException extends AppBaseException {
const PublicAssetQuotaExceededException({required this.message}); const PublicAssetQuotaExceededException({String? message}) : super(message);
final String? message; @override
String get exceptionName => 'PublicAssetQuotaExceededException';
} }
class CannotDestroyPublicAssetException implements Exception { class CannotDestroyPublicAssetException extends AppBaseException {
const CannotDestroyPublicAssetException(); const CannotDestroyPublicAssetException([super.message]);
@override
String get exceptionName => 'CannotDestroyPublicAssetException';
} }
class CannotUpdatePublicAssetException implements Exception { class CannotUpdatePublicAssetException extends AppBaseException {
const CannotUpdatePublicAssetException(); 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 { } else {
final rootIsolateToken = RootIsolateToken.instance; final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) { if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken(); throw const CanNotGetRootIsolateToken();
} }
final result = await _isolateExecutor.execute( 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 { } else {
final rootIsolateToken = RootIsolateToken.instance; final rootIsolateToken = RootIsolateToken.instance;
if (rootIsolateToken == null) { if (rootIsolateToken == null) {
throw CanNotGetRootIsolateToken(); throw const CanNotGetRootIsolateToken();
} }
return await _isolateExecutor.execute( 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';
}
+17 -9
View File
@@ -1,18 +1,26 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart';
import 'package:core/domain/exceptions/app_base_exception.dart';
class InvalidCapability extends AppBaseException with EquatableMixin {
const InvalidCapability([super.message]);
@override
String get exceptionName => 'InvalidCapability';
@override
List<Object?> get props => [message];
}
class SessionMissingCapability extends InvalidCapability { class SessionMissingCapability extends InvalidCapability {
final Set<CapabilityIdentifier> capabilityIdentifiers; final Set<CapabilityIdentifier> capabilityIdentifiers;
const SessionMissingCapability(this.capabilityIdentifiers) : super(); const SessionMissingCapability(this.capabilityIdentifiers)
: super('Missing capabilities $capabilityIdentifiers');
@override @override
List<Object?> get props => [capabilityIdentifiers]; String get exceptionName => 'SessionMissingCapability';
@override
List<Object?> get props => [capabilityIdentifiers, ...super.props];
} }
class InvalidCapability extends Equatable implements Exception {
const InvalidCapability();
@override
List<Object?> get props => [];
}
+15 -4
View File
@@ -1,16 +1,27 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
abstract class CacheException with EquatableMixin implements Exception { abstract class CacheException with EquatableMixin implements Exception {
final String? message; final String? message;
const CacheException({this.message}); const CacheException({this.message});
String get exceptionName;
@override
String toString() {
if (message != null) {
return '$exceptionName: $message';
}
return exceptionName;
}
} }
class UnknownCacheError extends CacheException { class UnknownCacheError extends CacheException {
const UnknownCacheError({String? message}) : super(message: message); const UnknownCacheError({String? message}) : super(message: message);
@override @override
List<Object> get props => []; String get exceptionName => 'UnknownCacheError';
}
@override
List<Object?> get props => [message];
}
+8 -1
View File
@@ -1 +1,8 @@
class CanNotGetRootIsolateToken implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class CanNotGetRootIsolateToken extends AppBaseException {
const CanNotGetRootIsolateToken([super.message]);
@override
String get exceptionName => 'CanNotGetRootIsolateToken';
}
+8 -1
View File
@@ -1 +1,8 @@
class InteractorNotInitialized implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class InteractorNotInitialized extends AppBaseException {
const InteractorNotInitialized([super.message]);
@override
String get exceptionName => 'InteractorNotInitialized';
}
+17 -4
View File
@@ -1,15 +1,28 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
abstract class PermissionException with EquatableMixin implements Exception { abstract class PermissionException with EquatableMixin implements Exception {
final String? message; final String? message;
const PermissionException({this.message}); const PermissionException({this.message});
String get exceptionName;
@override
String toString() {
if (message != null) {
return '$exceptionName: $message';
}
return exceptionName;
}
} }
class NotGrantedPermissionStorageException extends PermissionException { class NotGrantedPermissionStorageException extends PermissionException {
const NotGrantedPermissionStorageException() : super(message: 'Permission Storage has not been granted access'); const NotGrantedPermissionStorageException()
: super(message: 'Permission Storage has not been granted access');
@override @override
List<Object?> get props => [super.message]; String get exceptionName => 'NotGrantedPermissionStorageException';
}
@override
List<Object?> get props => [message];
}
+61 -14
View File
@@ -1,4 +1,3 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:jmap_dart_client/jmap/core/error/error_type.dart'; import 'package:jmap_dart_client/jmap/core/error/error_type.dart';
import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart'; import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart';
@@ -16,52 +15,98 @@ abstract class RemoteException with EquatableMixin implements Exception {
const RemoteException({this.code, this.message}); const RemoteException({this.code, this.message});
String get exceptionName;
@override
String toString() {
if (code != null) {
return '$exceptionName(code: $code): $message';
}
return '$exceptionName: $message';
}
@override @override
List<Object?> get props => [message, code]; List<Object?> get props => [message, code];
} }
class BadCredentialsException extends RemoteException { class BadCredentialsException extends RemoteException {
const BadCredentialsException() : super(message: RemoteException.badCredentials); const BadCredentialsException()
: super(message: RemoteException.badCredentials);
@override
String get exceptionName => 'BadCredentialsException';
} }
class UnknownError extends RemoteException { class UnknownError extends RemoteException {
const UnknownError({int? code, Object? message}) : super(code: code, message: message); const UnknownError({int? code, Object? message})
: super(code: code, message: message);
@override
String get exceptionName => 'UnknownError';
} }
class ConnectionError extends RemoteException { class ConnectionError extends RemoteException {
const ConnectionError({String? message}) : super(message: message ?? RemoteException.connectionError); const ConnectionError({String? message})
: super(message: message ?? RemoteException.connectionError);
@override
String get exceptionName => 'ConnectionError';
} }
class ConnectionTimeout extends RemoteException { class ConnectionTimeout extends RemoteException {
const ConnectionTimeout({String? message}) : super(message: message ?? RemoteException.connectionTimeout); const ConnectionTimeout({String? message})
: super(message: message ?? RemoteException.connectionTimeout);
@override
String get exceptionName => 'ConnectionTimeout';
} }
class SocketError extends RemoteException { class SocketError extends RemoteException {
const SocketError() : super(message: RemoteException.socketException); const SocketError() : super(message: RemoteException.socketException);
@override
String get exceptionName => 'SocketError';
} }
class InternalServerError extends RemoteException { class InternalServerError extends RemoteException {
const InternalServerError() : super(message: RemoteException.internalServerError); const InternalServerError()
: super(message: RemoteException.internalServerError);
@override
String get exceptionName => 'InternalServerError';
} }
class MethodLevelErrors extends RemoteException { class MethodLevelErrors extends RemoteException {
final ErrorType type; final ErrorType type;
const MethodLevelErrors( const MethodLevelErrors(this.type, {String? message})
this.type, : super(message: message);
{String? message}
) : super(message: message); @override
String get exceptionName => 'MethodLevelErrors';
@override
String toString() {
return '$exceptionName(type: $type): $message';
}
@override @override
List<Object?> get props => [type, ...super.props]; List<Object?> get props => [type, ...super.props];
} }
class CannotCalculateChangesMethodResponseException extends MethodLevelErrors { class CannotCalculateChangesMethodResponseException extends MethodLevelErrors {
CannotCalculateChangesMethodResponseException({String? message}) : super(ErrorMethodResponse.cannotCalculateChanges, message: message); CannotCalculateChangesMethodResponseException({String? message})
: super(ErrorMethodResponse.cannotCalculateChanges, message: message);
@override
String get exceptionName => 'CannotCalculateChangesMethodResponseException';
} }
class NoNetworkError extends RemoteException { class NoNetworkError extends RemoteException {
const NoNetworkError() : super(message: RemoteException.noNetworkError); const NoNetworkError() : super(message: RemoteException.noNetworkError);
@override
String get exceptionName => 'NoNetworkError';
} }
class RefreshTokenFailedException extends RemoteException { class RefreshTokenFailedException extends RemoteException {
@@ -74,6 +119,8 @@ class RefreshTokenFailedException extends RemoteException {
}); });
@override @override
String toString() => String get exceptionName => 'RefreshTokenFailedException';
"RefreshTokenFailedException(status: $statusCode): $message";
} @override
String toString() => "$exceptionName(status: $statusCode): $message";
}
+6 -6
View File
@@ -20,21 +20,21 @@ import 'package:model/email/email_action_type.dart';
import 'package:model/email/mark_star_action.dart'; import 'package:model/email/mark_star_action.dart';
import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:model/mailbox/presentation_mailbox.dart';
import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart'; import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart';
import 'package:tmail_ui_user/features/download/domain/state/parse_email_by_blob_id_state.dart';
import 'package:tmail_ui_user/features/download/domain/state/preview_email_from_eml_file_state.dart';
import 'package:tmail_ui_user/features/email/domain/exceptions/calendar_event_exceptions.dart'; import 'package:tmail_ui_user/features/email/domain/exceptions/calendar_event_exceptions.dart';
import 'package:tmail_ui_user/features/email/domain/model/move_action.dart'; import 'package:tmail_ui_user/features/email/domain/model/move_action.dart';
import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_an_email_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_a_thread_state.dart'; import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_a_thread_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_an_email_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart'; import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/labels/remove_a_label_from_a_thread_state.dart'; import 'package:tmail_ui_user/features/email/domain/state/labels/remove_a_label_from_a_thread_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/mark_as_email_star_state.dart'; import 'package:tmail_ui_user/features/email/domain/state/mark_as_email_star_state.dart';
import 'package:tmail_ui_user/features/download/domain/state/parse_email_by_blob_id_state.dart';
import 'package:tmail_ui_user/features/download/domain/state/preview_email_from_eml_file_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/remove_a_label_from_an_email_state.dart'; import 'package:tmail_ui_user/features/email/domain/state/remove_a_label_from_an_email_state.dart';
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart'; import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
import 'package:tmail_ui_user/features/home/domain/state/get_session_state.dart'; import 'package:tmail_ui_user/features/home/domain/state/get_session_state.dart';
import 'package:tmail_ui_user/features/labels/domain/state/create_new_label_state.dart'; import 'package:tmail_ui_user/features/labels/domain/state/create_new_label_state.dart';
import 'package:tmail_ui_user/features/labels/domain/state/edit_label_state.dart';
import 'package:tmail_ui_user/features/labels/domain/state/delete_a_label_state.dart'; import 'package:tmail_ui_user/features/labels/domain/state/delete_a_label_state.dart';
import 'package:tmail_ui_user/features/labels/domain/state/edit_label_state.dart';
import 'package:tmail_ui_user/features/login/data/network/oidc_error.dart'; import 'package:tmail_ui_user/features/login/data/network/oidc_error.dart';
import 'package:tmail_ui_user/features/login/domain/exceptions/authentication_exception.dart'; import 'package:tmail_ui_user/features/login/domain/exceptions/authentication_exception.dart';
import 'package:tmail_ui_user/features/login/domain/exceptions/oauth_authorization_error.dart'; import 'package:tmail_ui_user/features/login/domain/exceptions/oauth_authorization_error.dart';
@@ -133,9 +133,9 @@ class ToastManager {
return '[${firstError.type.value}] ${firstError.description}'; return '[${firstError.type.value}] ${firstError.description}';
} }
} else if (exception is ServerError) { } else if (exception is ServerError) {
return '[${exception.error}] ${exception.errorDescription}'; return '[${exception.error}] ${exception.message}';
} else if (exception is TemporarilyUnavailable) { } else if (exception is TemporarilyUnavailable) {
return '[${exception.error}] ${exception.errorDescription}'; return '[${exception.error}] ${exception.message}';
} else if (exception is AutoRedirectToAppAfterStoreAuthorizeDestinationUrlException) { } else if (exception is AutoRedirectToAppAfterStoreAuthorizeDestinationUrlException) {
return ''; return '';
} }
@@ -1,2 +1,8 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundPersonalAccountException implements Exception {} class NotFoundPersonalAccountException extends AppBaseException {
const NotFoundPersonalAccountException([super.message]);
@override
String get exceptionName => 'NotFoundPersonalAccountException';
}
@@ -1 +1,8 @@
class UnknownAddressException implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class UnknownAddressException extends AppBaseException {
const UnknownAddressException([super.message]);
@override
String get exceptionName => 'UnknownAddressException';
}
@@ -1 +1,8 @@
class UnknownUriException implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class UnknownUriException extends AppBaseException {
const UnknownUriException([super.message]);
@override
String get exceptionName => 'UnknownUriException';
}
@@ -1,7 +1,29 @@
class AccessTokenIsNullException implements Exception {} import 'package:core/domain/exceptions/app_base_exception.dart';
class RefreshTokenIsNullException implements Exception {} class AccessTokenIsNullException extends AppBaseException {
AccessTokenIsNullException([super.message]);
class TokenIdIsNullException implements Exception {} @override
String get exceptionName => 'AccessTokenIsNullException';
}
class ExpiresTimeIsNullException implements Exception {} class RefreshTokenIsNullException extends AppBaseException {
RefreshTokenIsNullException([super.message]);
@override
String get exceptionName => 'RefreshTokenIsNullException';
}
class TokenIdIsNullException extends AppBaseException {
TokenIdIsNullException([super.message]);
@override
String get exceptionName => 'TokenIdIsNullException';
}
class ExpiresTimeIsNullException extends AppBaseException {
ExpiresTimeIsNullException([super.message]);
@override
String get exceptionName => 'ExpiresTimeIsNullException';
}
+4 -4
View File
@@ -30,7 +30,7 @@ extension SessionExtension on Session {
} else if (downloadUrl.hasOrigin) { } else if (downloadUrl.hasOrigin) {
downloadUrlValid = downloadUrl; downloadUrlValid = downloadUrl;
} else { } else {
throw UnknownUriException(); throw const UnknownUriException();
} }
var baseUrl = '${downloadUrlValid.origin}${downloadUrlValid.path}?${downloadUrlValid.query}'; var baseUrl = '${downloadUrlValid.origin}${downloadUrlValid.path}?${downloadUrlValid.query}';
@@ -56,7 +56,7 @@ extension SessionExtension on Session {
} else if (uploadUrl.hasOrigin) { } else if (uploadUrl.hasOrigin) {
uploadUrlValid = uploadUrl; uploadUrlValid = uploadUrl;
} else { } else {
throw UnknownUriException(); throw const UnknownUriException();
} }
final baseUrl = '${uploadUrlValid.origin}${uploadUrlValid.path}'; final baseUrl = '${uploadUrlValid.origin}${uploadUrlValid.path}';
@@ -109,7 +109,7 @@ extension SessionExtension on Session {
return username.value.isEmail ? username.value return username.value.isEmail ? username.value
: _getOwnEmailAddressFromPersonalAccount() : _getOwnEmailAddressFromPersonalAccount()
?? _getOwnEmailAddressFromPrincipalsCapability() ?? _getOwnEmailAddressFromPrincipalsCapability()
?? (throw UnknownAddressException()); ?? (throw const UnknownAddressException());
} }
String? _getOwnEmailAddressFromPersonalAccount() { String? _getOwnEmailAddressFromPersonalAccount() {
@@ -168,7 +168,7 @@ extension SessionExtension on Session {
return listPersonalAccount.first; return listPersonalAccount.first;
} }
} }
throw NotFoundPersonalAccountException(); throw const NotFoundPersonalAccountException();
} }
AccountId get accountId => personalAccount.accountId; AccountId get accountId => personalAccount.accountId;
@@ -1,26 +1,39 @@
class AIApiException implements Exception { import 'package:core/domain/exceptions/app_base_exception.dart';
final String message;
class AIApiException extends AppBaseException {
final int? statusCode; final int? statusCode;
AIApiException(this.message, {this.statusCode}); const AIApiException(super.message, {this.statusCode});
@override
String get exceptionName => 'AIApiException';
@override @override
String toString() { String toString() {
if (statusCode != null) { final statusPart = statusCode != null ? ' (status code: $statusCode)' : '';
return 'AIApiException: $message (status code: $statusCode)'; return '$exceptionName: $message$statusPart';
}
return 'AIApiException: $message';
} }
} }
class AIApiNotAvailableException extends AIApiException { class AIApiNotAvailableException extends AIApiException {
AIApiNotAvailableException() : super('AI API is not available'); const AIApiNotAvailableException() : super('AI API is not available');
@override
String get exceptionName => 'AIApiNotAvailableException';
} }
class AIApiEmptyResponseException extends AIApiException { class AIApiEmptyResponseException extends AIApiException {
AIApiEmptyResponseException() : super('AI API returned empty response'); const AIApiEmptyResponseException() : super('AI API returned empty response');
@override
String get exceptionName => 'AIApiEmptyResponseException';
} }
class GenerateAITextInteractorIsNotRegisteredException extends AIApiException { class GenerateAITextInteractorIsNotRegisteredException extends AIApiException {
GenerateAITextInteractorIsNotRegisteredException() : super('GenerateAITextInteractor is not registered'); const GenerateAITextInteractorIsNotRegisteredException()
} : super('GenerateAITextInteractor is not registered');
@override
String get exceptionName =>
'GenerateAITextInteractorIsNotRegisteredException';
}
@@ -50,7 +50,7 @@ class _AiScribeSuggestionWidgetState extends State<AiScribeSuggestionWidget> {
if (!Get.isRegistered<GenerateAITextInteractor>()) { if (!Get.isRegistered<GenerateAITextInteractor>()) {
_state.value = dartz.Left( _state.value = dartz.Left(
GenerateAITextFailure( GenerateAITextFailure(
GenerateAITextInteractorIsNotRegisteredException(), const GenerateAITextInteractorIsNotRegisteredException(),
), ),
); );
return; return;
+4 -1
View File
@@ -54,7 +54,10 @@ class MockBaseController extends BaseController {
} }
} }
class SomeOtherException extends RemoteException {} class SomeOtherException extends RemoteException {
@override
String get exceptionName => 'SomeOtherException';
}
@GenerateNiceMocks([ @GenerateNiceMocks([
MockSpec<CachingManager>(), MockSpec<CachingManager>(),