TF-2928 Write unit test for validateUrgentException and onError in BaseController

This commit is contained in:
dab246
2024-07-16 14:12:50 +07:00
committed by Dat H. Pham
parent 77246a9d36
commit 103dc9c5e3
4 changed files with 207 additions and 35 deletions
+4 -4
View File
@@ -111,7 +111,7 @@ abstract class BaseController extends GetxController
html.window.onUnload.listen(handleBrowserReloadAction);
}
Future<void> handleBrowserBeforeReloadAction(html.Event event) async {}
Future<void> handleBrowserBeforeReloadAction(html.Event event) async {}
Future<void> handleBrowserReloadAction(html.Event event) async {}
@@ -141,7 +141,7 @@ abstract class BaseController extends GetxController
viewState.value.fold(
(failure) {
if (failure is FeatureFailure) {
final isUrgentException = _validateUrgentException(failure.exception);
final isUrgentException = validateUrgentException(failure.exception);
if (isUrgentException) {
handleUrgentException(failure: failure, exception: failure.exception);
} else {
@@ -156,7 +156,7 @@ abstract class BaseController extends GetxController
void onError(dynamic error, StackTrace stackTrace) {
logError('$runtimeType::onError():Error: $error | StackTrace: $stackTrace');
final isUrgentException = _validateUrgentException(error);
final isUrgentException = validateUrgentException(error);
if (isUrgentException) {
handleUrgentException(exception: error);
} else {
@@ -166,7 +166,7 @@ abstract class BaseController extends GetxController
void onDone() {}
bool _validateUrgentException(dynamic exception) {
bool validateUrgentException(dynamic exception) {
return exception is NoNetworkError
|| exception is BadCredentialsException
|| exception is ConnectionError;