fix: Prefer reusing AppBaseException instead of redefining the exception contract CacheException and RemoteException

This commit is contained in:
dab246
2026-03-09 10:27:16 +07:00
committed by Dat H. Pham
parent 236ad5f075
commit 8a21e35d1e
139 changed files with 344 additions and 325 deletions
@@ -0,0 +1,34 @@
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:tmail_ui_user/main/exceptions/remote/remote_exception.dart';
class MethodLevelErrors extends RemoteException {
final ErrorType type;
const MethodLevelErrors(
this.type, {
String? message,
}) : super(message: message);
@override
String get exceptionName => 'MethodLevelErrors';
@override
String toString() {
return '$exceptionName(type: $type): $message';
}
@override
List<Object?> get props => [type, ...super.props];
}
class CannotCalculateChangesMethodResponseException extends MethodLevelErrors {
CannotCalculateChangesMethodResponseException({String? message})
: super(
ErrorMethodResponse.cannotCalculateChanges,
message: message,
);
@override
String get exceptionName => 'CannotCalculateChangesMethodResponseException';
}