TF-2928 Handle connection error exception

This commit is contained in:
dab246
2024-07-12 18:59:52 +07:00
committed by Dat H. Pham
parent eca11b3506
commit e6094fb623
+10 -10
View File
@@ -188,11 +188,7 @@ abstract class BaseController extends GetxController
void handleUrgentExceptionOnMobile({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnMobile():Failure: $failure | Exception: $exception');
if (exception is ConnectionError) {
if (currentOverlayContext != null && currentContext != null) {
appToast.showToastErrorMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).connectionError);
}
_handleConnectionErrorException();
} else if (exception is BadCredentialsException) {
_executeBeforeUnloadAndLogOut();
}
@@ -213,11 +209,7 @@ abstract class BaseController extends GetxController
infinityToast: true,);
}
} else if (exception is ConnectionError) {
if (currentOverlayContext != null && currentContext != null) {
appToast.showToastErrorMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).connectionError);
}
_handleConnectionErrorException();
} else if (exception is BadCredentialsException) {
_executeBeforeUnloadAndLogOut();
}
@@ -228,6 +220,14 @@ abstract class BaseController extends GetxController
clearDataAndGoToLoginPage();
}
void _handleConnectionErrorException() {
if (currentOverlayContext != null && currentContext != null) {
appToast.showToastErrorMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).connectionError);
}
}
void handleFailureViewState(Failure failure) async {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
if (failure is LogoutOidcFailure) {