fix: The message field in UnknownRemoteException is typed as String? and the condition will always be false.
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ class CreateNewAndSaveEmailToDraftsInteractor {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logWarning('CreateNewAndSaveEmailToDraftsInteractor::execute: Exception: $e');
|
logWarning('CreateNewAndSaveEmailToDraftsInteractor::execute: Exception: $e');
|
||||||
if (e is UnknownRemoteException && e.message is List<SavingEmailToDraftsCanceledException>) {
|
if (e is UnknownRemoteException && e.error is List<SavingEmailToDraftsCanceledException>) {
|
||||||
if (createEmailRequest.draftsEmailId == null) {
|
if (createEmailRequest.draftsEmailId == null) {
|
||||||
yield dartz.Left<Failure, Success>(SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
|
yield dartz.Left<Failure, Success>(SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class CreateNewAndSendEmailInteractor {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logWarning('CreateNewAndSendEmailInteractor::execute: Exception: $e');
|
logWarning('CreateNewAndSendEmailInteractor::execute: Exception: $e');
|
||||||
if (e is UnknownRemoteException && e.message is List<SendingEmailCanceledException>) {
|
if (e is UnknownRemoteException && e.error is List<SendingEmailCanceledException>) {
|
||||||
yield dartz.Left<Failure, Success>(SendEmailFailure(
|
yield dartz.Left<Failure, Success>(SendEmailFailure(
|
||||||
exception: SendingEmailCanceledException(),
|
exception: SendingEmailCanceledException(),
|
||||||
session: sendingEmailArguments?.session,
|
session: sendingEmailArguments?.session,
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class _SavingMessageDialogViewState extends State<SavingMessageDialogView> {
|
|||||||
|
|
||||||
void _handleErrorStream(Object error, StackTrace stackTrace) {
|
void _handleErrorStream(Object error, StackTrace stackTrace) {
|
||||||
logWarning('_SavingMessageDialogViewState::_handleErrorStream: Exception = $error');
|
logWarning('_SavingMessageDialogViewState::_handleErrorStream: Exception = $error');
|
||||||
if (error is UnknownRemoteException && error.message is List<SavingEmailToDraftsCanceledException>) {
|
if (error is UnknownRemoteException && error.error is List<SavingEmailToDraftsCanceledException>) {
|
||||||
popBack(result: SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
|
popBack(result: SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
|
||||||
} else {
|
} else {
|
||||||
popBack(result: SaveEmailAsDraftsFailure(error));
|
popBack(result: SaveEmailAsDraftsFailure(error));
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class _SendingMessageDialogViewState extends State<SendingMessageDialogView> {
|
|||||||
|
|
||||||
void _handleErrorStream(Object error, StackTrace stackTrace) {
|
void _handleErrorStream(Object error, StackTrace stackTrace) {
|
||||||
logWarning('_SendingMessageDialogViewState::_handleErrorStream: Exception = $error');
|
logWarning('_SendingMessageDialogViewState::_handleErrorStream: Exception = $error');
|
||||||
if (error is UnknownRemoteException && error.message is List<SendingEmailCanceledException>) {
|
if (error is UnknownRemoteException && error.error is List<SendingEmailCanceledException>) {
|
||||||
popBack(result: SendEmailFailure(exception: SendingEmailCanceledException()));
|
popBack(result: SendEmailFailure(exception: SendingEmailCanceledException()));
|
||||||
} else {
|
} else {
|
||||||
popBack(result: SendEmailFailure(exception: error));
|
popBack(result: SendEmailFailure(exception: error));
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
import 'package:tmail_ui_user/main/exceptions/remote/remote_exception.dart';
|
import 'package:tmail_ui_user/main/exceptions/remote/remote_exception.dart';
|
||||||
|
|
||||||
class UnknownRemoteException extends RemoteException {
|
class UnknownRemoteException extends RemoteException {
|
||||||
|
|
||||||
|
final Object? error;
|
||||||
|
|
||||||
const UnknownRemoteException({
|
const UnknownRemoteException({
|
||||||
super.code,
|
super.code,
|
||||||
super.message,
|
super.message,
|
||||||
|
this.error,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get exceptionName => 'UnknownRemoteException';
|
String get exceptionName => 'UnknownRemoteException';
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [...super.props, error];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class RemoteExceptionThrower extends ExceptionThrower {
|
|||||||
} else if (underlyingError is OAuthAuthorizationError) {
|
} else if (underlyingError is OAuthAuthorizationError) {
|
||||||
throw underlyingError;
|
throw underlyingError;
|
||||||
} else if (underlyingError != null) {
|
} else if (underlyingError != null) {
|
||||||
throw UnknownRemoteException(message: underlyingError.toString());
|
throw UnknownRemoteException(error: underlyingError);
|
||||||
} else {
|
} else {
|
||||||
throw const UnknownRemoteException();
|
throw const UnknownRemoteException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user