From 9f8eab3e01fac24dccdd6d560dc5d678acf15d67 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 7 Jun 2023 11:56:01 +0700 Subject: [PATCH] TF-1899 Add failure param when handleExceptionAction (cherry picked from commit 3e87b9fb2c17ebc6524003d3587be02317a7a768) --- lib/features/base/base_controller.dart | 8 ++++---- lib/features/login/presentation/login_controller.dart | 4 ++-- lib/features/session/presentation/session_controller.dart | 6 +++--- lib/features/thread/presentation/thread_controller.dart | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 4c6ab02c9..1bfbaafff 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -96,7 +96,7 @@ abstract class BaseController extends GetxController if (failure is FeatureFailure) { final exception = _performFilterExceptionInError(failure.exception); if (exception != null) { - handleExceptionAction(exception); + handleExceptionAction(failure: failure, exception: exception); } else { handleFailureViewState(failure); } @@ -111,7 +111,7 @@ abstract class BaseController extends GetxController logError('BaseController::onError():error: $error | stackTrace: $stackTrace'); final exception = _performFilterExceptionInError(error); if (exception != null) { - handleExceptionAction(exception); + handleExceptionAction(exception: exception); } else { handleErrorViewState(error, stackTrace); } @@ -150,8 +150,8 @@ abstract class BaseController extends GetxController void handleErrorViewState(Object error, StackTrace stackTrace) {} - void handleExceptionAction(Exception exception) { - log('BaseController::handleExceptionAction():exception: $exception'); + void handleExceptionAction({Failure? failure, Exception? exception}) { + log('BaseController::handleExceptionAction():failure: $failure | exception: $exception'); } void handleFailureViewState(Failure failure) { diff --git a/lib/features/login/presentation/login_controller.dart b/lib/features/login/presentation/login_controller.dart index d8d6c140e..68cbaab70 100644 --- a/lib/features/login/presentation/login_controller.dart +++ b/lib/features/login/presentation/login_controller.dart @@ -189,8 +189,8 @@ class LoginController extends ReloadableController { } @override - void handleExceptionAction(Exception exception) { - super.handleExceptionAction(exception); + void handleExceptionAction({Failure? failure, Exception? exception}) { + super.handleExceptionAction(failure: failure, exception: exception); loginState.value = LoginState(Right(LoginInitAction())); } diff --git a/lib/features/session/presentation/session_controller.dart b/lib/features/session/presentation/session_controller.dart index 283d4bb2e..831cee088 100644 --- a/lib/features/session/presentation/session_controller.dart +++ b/lib/features/session/presentation/session_controller.dart @@ -74,9 +74,9 @@ class SessionController extends ReloadableController { } @override - void handleExceptionAction(Exception exception) { - super.handleExceptionAction(exception); - if (PlatformInfo.isMobile && exception is NoNetworkError) { + void handleExceptionAction({Failure? failure, Exception? exception}) { + super.handleExceptionAction(failure: failure, exception: exception); + if (PlatformInfo.isMobile && failure is GetSessionFailure && exception is NoNetworkError) { _handleGetStoredSession(); } } diff --git a/lib/features/thread/presentation/thread_controller.dart b/lib/features/thread/presentation/thread_controller.dart index 67cc504ef..6ef930108 100644 --- a/lib/features/thread/presentation/thread_controller.dart +++ b/lib/features/thread/presentation/thread_controller.dart @@ -190,8 +190,8 @@ class ThreadController extends BaseController with EmailActionController { } @override - void handleExceptionAction(Exception exception) { - super.handleExceptionAction(exception); + void handleExceptionAction({Failure? failure, Exception? exception}) { + super.handleExceptionAction(failure: failure, exception: exception); clearState(); }