TF-2928 Handle not network error exception

This commit is contained in:
dab246
2024-07-12 19:00:37 +07:00
committed by Dat H. Pham
parent e6094fb623
commit a769c43dfe
+15 -11
View File
@@ -197,17 +197,7 @@ abstract class BaseController extends GetxController
void handleUrgentExceptionOnWeb({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnWeb():Failure: $failure | Exception: $exception');
if (exception is NoNetworkError) {
if (currentOverlayContext != null && currentContext != null) {
appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).no_internet_connection,
actionName: AppLocalizations.of(currentContext!).skip,
onActionClick: ToastView.dismiss,
leadingSVGIcon: imagePaths.icNotConnection,
backgroundColor: AppColor.textFieldErrorBorderColor,
textColor: Colors.white,
infinityToast: true,);
}
_handleNotNetworkErrorException();
} else if (exception is ConnectionError) {
_handleConnectionErrorException();
} else if (exception is BadCredentialsException) {
@@ -228,6 +218,20 @@ abstract class BaseController extends GetxController
}
}
void _handleNotNetworkErrorException() {
if (currentOverlayContext != null && currentContext != null) {
appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).no_internet_connection,
actionName: AppLocalizations.of(currentContext!).skip,
onActionClick: ToastView.dismiss,
leadingSVGIcon: imagePaths.icNotConnection,
backgroundColor: AppColor.textFieldErrorBorderColor,
textColor: Colors.white,
infinityToast: true);
}
}
void handleFailureViewState(Failure failure) async {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
if (failure is LogoutOidcFailure) {