TF-4136 refactor(logging): replace logError with logWarning for non-critical cases

This commit is contained in:
dab246
2026-01-02 12:18:38 +07:00
committed by Dat H. Pham
parent 73dcb6067c
commit a23d15a9ca
160 changed files with 382 additions and 360 deletions
@@ -5,7 +5,11 @@ class CacheExceptionThrower extends ExceptionThrower {
@override
throwException(dynamic error, dynamic stackTrace) {
logError('CacheExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
logError(
'CacheExceptionThrower::throwException():error: $error',
exception: error,
stackTrace: stackTrace,
);
throw error;
}
}
@@ -17,10 +17,14 @@ class RemoteExceptionThrower extends ExceptionThrower {
@override
throwException(dynamic error, dynamic stackTrace) {
logError('RemoteExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
logError(
'RemoteExceptionThrower::throwException():error: $error | stackTrace: $stackTrace',
exception: error,
stackTrace: stackTrace,
);
final networkConnectionController = getBinding<NetworkConnectionController>();
if (networkConnectionController?.isNetworkConnectionAvailable() == false) {
logError('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable');
logWarning('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable');
throw const NoNetworkError();
} else {
handleDioError(error);
@@ -29,7 +33,7 @@ class RemoteExceptionThrower extends ExceptionThrower {
void handleDioError(dynamic error) {
if (error is DioError) {
logError(
logWarning(
'RemoteExceptionThrower::throwException():type: ${error.type} | response: ${error.response} | error: ${error.error}',
);
@@ -10,11 +10,15 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
class SendEmailExceptionThrower extends RemoteExceptionThrower {
@override
FutureOr<void> throwException(error, stackTrace) async {
log('SendEmailExceptionThrower::throwException(): $error | stackTrace: $stackTrace');
logError(
'SendEmailExceptionThrower::throwException():error: $error | stackTrace: $stackTrace',
exception: error,
stackTrace: stackTrace,
);
final networkConnectionController = getBinding<NetworkConnectionController>();
final realtimeNetworkConnectionStatus = await networkConnectionController?.hasInternetConnection();
if (realtimeNetworkConnectionStatus == false) {
logError('SendEmailExceptionThrower::throwException(): No realtime network connection');
logWarning('SendEmailExceptionThrower::throwException(): No realtime network connection');
throw const NoNetworkError();
} else {
handleDioError(error);