TF-1829 Fix app crash upon 401

(cherry picked from commit 8906322f932c4e1edadaf3f1831fc533fddd9a8b)
This commit is contained in:
dab246
2023-06-28 16:10:13 +07:00
committed by Dat Vu
parent e9f3f7f012
commit 7c1f8cc2c7
6 changed files with 47 additions and 13 deletions
+13 -1
View File
@@ -121,7 +121,8 @@ abstract class BaseController extends GetxController
Exception? _performFilterExceptionInError(dynamic error) {
logError('BaseController::_performFilterExceptionInError(): $error');
if (error is NoNetworkError || error is ConnectError || error is InternalServerError) {
if (error is NoNetworkError || error is ConnectionTimeout || error is InternalServerError) {
logError('BaseController::_performFilterExceptionInError(): NoNetworkError');
if (currentOverlayContext != null && currentContext != null) {
_appToast.showToastMessage(
currentOverlayContext!,
@@ -136,6 +137,7 @@ abstract class BaseController extends GetxController
}
return error;
} else if (error is BadCredentialsException) {
logError('BaseController::_performFilterExceptionInError(): BadCredentialsException');
if (currentOverlayContext != null && currentContext != null) {
_appToast.showToastErrorMessage(
currentOverlayContext!,
@@ -143,6 +145,15 @@ abstract class BaseController extends GetxController
}
performInvokeLogoutAction();
return error;
} else if (error is ConnectionError) {
logError('BaseController::_performFilterExceptionInError(): ConnectionError');
if (currentOverlayContext != null && currentContext != null) {
_appToast.showToastErrorMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).connectionError);
}
performInvokeLogoutAction();
return error;
}
return null;
@@ -306,6 +317,7 @@ abstract class BaseController extends GetxController
}
void performInvokeLogoutAction() {
log('BaseController::performInvokeLogoutAction():');
if (isAuthenticatedWithOidc) {
_logoutOIDCAction();
} else {