TF-1813 Add log stackTrace in ExceptionThrower

(cherry picked from commit a1634ad2553fb331603738620b416a5a7dda66a8)
This commit is contained in:
dab246
2023-06-01 13:52:32 +07:00
committed by Dat Vu
parent 8201617a7f
commit bf902d79ee
4 changed files with 7 additions and 7 deletions
@@ -51,9 +51,7 @@ class CacheFCMDatasourceImpl extends FCMDatasource {
Future<void> storeSubscription(FCMSubscriptionCache fcmSubscriptionCache) { Future<void> storeSubscription(FCMSubscriptionCache fcmSubscriptionCache) {
return Future.sync(() async { return Future.sync(() async {
return await _firebaseCacheManager.storeSubscription(fcmSubscriptionCache); return await _firebaseCacheManager.storeSubscription(fcmSubscriptionCache);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -1,9 +1,11 @@
import 'package:core/utils/app_logger.dart';
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart'; import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
class CacheExceptionThrower extends ExceptionThrower { class CacheExceptionThrower extends ExceptionThrower {
@override @override
throwException(dynamic error) { throwException(dynamic error, dynamic stackTrace) {
logError('CacheExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
throw error; throw error;
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
abstract class ExceptionThrower { abstract class ExceptionThrower {
throwException(dynamic error); throwException(dynamic error, dynamic stackTrace);
} }
@@ -14,8 +14,8 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
class RemoteExceptionThrower extends ExceptionThrower { class RemoteExceptionThrower extends ExceptionThrower {
@override @override
throwException(dynamic error) { throwException(dynamic error, dynamic stackTrace) {
logError('RemoteExceptionThrower::throwException():error: $error'); logError('RemoteExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
final networkConnectionController = getBinding<NetworkConnectionController>(); final networkConnectionController = getBinding<NetworkConnectionController>();
if (networkConnectionController?.isNetworkConnectionAvailable() == false) { if (networkConnectionController?.isNetworkConnectionAvailable() == false) {
logError('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable'); logError('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable');