TF-1829 Fix app crash upon 401
(cherry picked from commit 8906322f932c4e1edadaf3f1831fc533fddd9a8b)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -101,6 +101,8 @@ class SessionController extends ReloadableController {
|
||||
errorMessage = AppLocalizations.of(currentContext!).wrongUrlMessage;
|
||||
} else if (sessionException is BadCredentialsException && currentContext != null) {
|
||||
errorMessage = AppLocalizations.of(currentContext!).badCredentials;
|
||||
} else if (sessionException is ConnectionError && currentContext != null) {
|
||||
errorMessage = AppLocalizations.of(currentContext!).connectionError;
|
||||
} else if (sessionException is UnknownError && currentContext != null) {
|
||||
if (sessionException.message != null && sessionException.code != null) {
|
||||
errorMessage = '[${sessionException.code}] ${sessionException.message}';
|
||||
@@ -119,7 +121,7 @@ class SessionController extends ReloadableController {
|
||||
}
|
||||
|
||||
bool _checkUrlError(dynamic sessionException) {
|
||||
return sessionException is ConnectError || sessionException is BadGateway || sessionException is SocketError;
|
||||
return sessionException is ConnectionTimeout || sessionException is BadGateway || sessionException is SocketError;
|
||||
}
|
||||
|
||||
void _goToMailboxDashBoard(Session session) {
|
||||
|
||||
Reference in New Issue
Block a user