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
@@ -74,7 +74,7 @@ mixin AuthenticationClientInteractionMixin {
dynamic handleException(dynamic exception) {
if (exception is FlutterAppAuthPlatformException) {
logError('$runtimeType::handleException: ErrorDetails = ${exception.platformErrorDetails.toString()}');
logWarning('$runtimeType::handleException: ErrorDetails = ${exception.platformErrorDetails.toString()}');
final errorCode = exception.platformErrorDetails.error;
if (errorCode != null) {
final oauthErrorCode = OAuthAuthorizationError.fromErrorCode(
@@ -92,7 +92,7 @@ class AuthenticationClientMobile with AuthenticationClientInteractionMixin
throw AccessTokenInvalidException();
}
} catch (e) {
logError('$runtimeType::refreshingTokensOIDC(): $e');
logWarning('$runtimeType::refreshingTokensOIDC(): $e');
throw handleException(e);
}
}
@@ -89,7 +89,7 @@ class AuthenticationClientWeb with AuthenticationClientInteractionMixin
throw AccessTokenInvalidException();
}
} catch (e) {
logError('$runtimeType::refreshingTokensOIDC(): $e');
logWarning('$runtimeType::refreshingTokensOIDC(): $e');
throw handleException(e);
}
}
@@ -70,10 +70,10 @@ class DnsLookupManager {
}
log('$runtimeType::lookupJmapUrl → ⚠️ No records via ${priority.label}, continuing...');
} on TimeoutException catch (_) {
logError(
logWarning(
'$runtimeType::lookupJmapUrl → ⏱️ ${priority.label} lookup timed out');
} catch (error, stack) {
logError(
logWarning(
'$runtimeType::lookupJmapUrl → ❌ ${priority.label} lookup failed: $error, $stack');
}
}
@@ -83,7 +83,7 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
@override
void onError(DioError err, ErrorInterceptorHandler handler) async {
logError('AuthorizationInterceptors::onError(): DIO_ERROR = $err');
logWarning('AuthorizationInterceptors::onError(): DIO_ERROR = $err');
try {
final requestOptions = err.requestOptions;
final extraInRequest = requestOptions.extra;
@@ -151,8 +151,12 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
} else {
return super.onError(err, handler);
}
} catch (e) {
logError('AuthorizationInterceptors::onError:Exception: $e');
} catch (e, stackTrace) {
logError(
'AuthorizationInterceptors::onError:Exception: $e',
exception: e,
stackTrace: stackTrace,
);
if (e is ServerError || e is TemporarilyUnavailable) {
return super.onError(
DioError(requestOptions: err.requestOptions, error: e),
@@ -166,14 +170,17 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
Stream<List<int>>? _getDataUploadRequest(dynamic mapUploadExtra) {
try {
String? filePath = mapUploadExtra[FileUploader.filePathExtraKey];
if (mapUploadExtra is! Map) return null;
final filePath = mapUploadExtra[FileUploader.filePathExtraKey] as String?;
if (filePath?.isNotEmpty == true) {
return File(filePath!).openRead();
} else {
return mapUploadExtra[FileUploader.streamDataExtraKey];
return mapUploadExtra[FileUploader.streamDataExtraKey] as Stream<List<int>>?;
}
} catch(e) {
log('AuthorizationInterceptors::_getDataUploadRequest: Exception = $e');
logWarning(
'AuthorizationInterceptors::_getDataUploadRequest: Exception = $e',
);
return null;
}
}