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
@@ -499,7 +499,7 @@ class EmailDataSourceImpl extends EmailDataSource {
return listEmailContent.asHtmlString;
} catch (e) {
logError('EmailDataSourceImpl::_transformEmailContent:Exception = $e');
logWarning('EmailDataSourceImpl::_transformEmailContent:Exception = $e');
return '';
}
}
@@ -87,7 +87,7 @@ class PrintFileDataSourceImpl extends PrintFileDataSource {
return htmlContentTransformed;
} catch (e) {
logError('PrintFileDataSourceImpl::_transformHtmlEmailContent: Exception: $e');
logWarning('PrintFileDataSourceImpl::_transformHtmlEmailContent: Exception: $e');
return '';
}
}
@@ -104,7 +104,7 @@ class HtmlAnalyzer {
return listEventAction;
}
} catch(e) {
logError('HtmlAnalyzer::getListEventAction:Exception: $e');
logWarning('HtmlAnalyzer::getListEventAction:Exception: $e');
return [];
}
}
@@ -205,7 +205,7 @@ class HtmlAnalyzer {
}));
return document.body?.innerHtml ?? emailContent;
} catch (e) {
logError('HtmlAnalyzer::removeCollapsedExpandedSignatureEffect:Exception = $e');
logWarning('HtmlAnalyzer::removeCollapsedExpandedSignatureEffect:Exception = $e');
return emailContent;
}
}
@@ -233,7 +233,7 @@ class HtmlAnalyzer {
log('HtmlAnalyzer::_retrieveAttachmentFromUpload:Attachment = $attachment | taskId = $taskId');
return (attachment, taskId);
} catch (e) {
logError('HtmlAnalyzer::_retrieveAttachmentFromUpload:Exception = $e');
logWarning('HtmlAnalyzer::_retrieveAttachmentFromUpload:Exception = $e');
return null;
}
}
@@ -259,7 +259,7 @@ class HtmlAnalyzer {
}));
return document.body?.innerHtml ?? emailContent;
} catch (e) {
logError('HtmlAnalyzer::removeStyleLazyLoadDisplayInlineImages:Exception = $e');
logWarning('HtmlAnalyzer::removeStyleLazyLoadDisplayInlineImages:Exception = $e');
return emailContent;
}
}
@@ -93,7 +93,7 @@ class CalendarEventAPI {
methodCallId,
GetCalendarEventAttendanceResponse.deserialize);
} catch (e) {
logError('CalendarEventAPI.parse free/busy query error: $e');
logWarning('CalendarEventAPI.parse free/busy query error: $e');
return null;
}
}
@@ -668,7 +668,7 @@ class EmailAPI with HandleSetErrorMixin, MailAPIMixin {
cancelToken: cancelToken
);
} catch (e) {
logError('EmailAPI::updateEmailDrafts: Exception = $e');
logWarning('EmailAPI::updateEmailDrafts: Exception = $e');
}
return emailCreated;
@@ -713,7 +713,7 @@ class EmailAPI with HandleSetErrorMixin, MailAPIMixin {
cancelToken: cancelToken
);
} catch (e) {
logError('EmailAPI::updateEmailTemplate: Exception = $e');
logWarning('EmailAPI::updateEmailTemplate: Exception = $e');
}
return emailCreated;
@@ -84,7 +84,7 @@ class EmailRepositoryImpl extends EmailRepository {
[emailRequest.emailIdAnsweredOrForwarded!],
);
} catch (e) {
logError('EmailRepositoryImpl::sendEmail::markAsAnswered:Exception $e');
logWarning('EmailRepositoryImpl::sendEmail::markAsAnswered:Exception $e');
}
} else if (emailRequest.isEmailForwarded) {
try {
@@ -94,7 +94,7 @@ class EmailRepositoryImpl extends EmailRepository {
[emailRequest.emailIdAnsweredOrForwarded!],
);
} catch (e) {
logError('EmailRepositoryImpl::sendEmail::markAsForwarded:Exception $e');
logWarning('EmailRepositoryImpl::sendEmail::markAsForwarded:Exception $e');
}
}
@@ -126,7 +126,7 @@ class EmailRepositoryImpl extends EmailRepository {
readActions,
);
} catch (e) {
logError('EmailRepositoryImpl::markAsRead:exception $e');
logWarning('EmailRepositoryImpl::markAsRead:exception $e');
}
return result;
@@ -168,7 +168,7 @@ class EmailRepositoryImpl extends EmailRepository {
),
);
} catch (e) {
logError('EmailRepositoryImpl::moveToMailbox:exception $e');
logWarning('EmailRepositoryImpl::moveToMailbox:exception $e');
}
return result;
@@ -198,7 +198,7 @@ class EmailRepositoryImpl extends EmailRepository {
markStarAction
);
} catch (e) {
logError('EmailRepositoryImpl::markAsStar:exception $e');
logWarning('EmailRepositoryImpl::markAsStar:exception $e');
}
return result;
}
@@ -241,7 +241,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken
);
} catch (e) {
logError('EmailRepositoryImpl::saveEmailAsDrafts:exception $e');
logWarning('EmailRepositoryImpl::saveEmailAsDrafts:exception $e');
}
return result;
}
@@ -267,7 +267,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken
);
} catch (e) {
logError('EmailRepositoryImpl::removeEmailDrafts:exception $e');
logWarning('EmailRepositoryImpl::removeEmailDrafts:exception $e');
}
return result;
}
@@ -295,7 +295,7 @@ class EmailRepositoryImpl extends EmailRepository {
oldEmailId,
);
} catch (e) {
logError('EmailRepositoryImpl::updateEmailDrafts:exception $e');
logWarning('EmailRepositoryImpl::updateEmailDrafts:exception $e');
}
return result;
}
@@ -326,7 +326,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken
);
} catch (e) {
logError('EmailRepositoryImpl::saveEmailAsTemplate:exception $e');
logWarning('EmailRepositoryImpl::saveEmailAsTemplate:exception $e');
}
return result;
}
@@ -354,7 +354,7 @@ class EmailRepositoryImpl extends EmailRepository {
oldEmailId,
);
} catch (e) {
logError('EmailRepositoryImpl::updateEmailTemplate:exception $e');
logWarning('EmailRepositoryImpl::updateEmailTemplate:exception $e');
}
return result;
}
@@ -378,7 +378,7 @@ class EmailRepositoryImpl extends EmailRepository {
await emailDataSource[DataSourceType.hiveCache]
!.deleteMultipleEmailsPermanently(session, accountId, result.emailIdsSuccess);
} catch (e) {
logError('EmailRepositoryImpl::deleteMultipleEmailsPermanently:exception $e');
logWarning('EmailRepositoryImpl::deleteMultipleEmailsPermanently:exception $e');
}
return result;
@@ -404,7 +404,7 @@ class EmailRepositoryImpl extends EmailRepository {
emailId,
);
} catch (e) {
logError('EmailRepositoryImpl::deleteEmailPermanently:exception $e');
logWarning('EmailRepositoryImpl::deleteEmailPermanently:exception $e');
}
return result;
@@ -106,7 +106,7 @@ class GetEmailContentInteractor {
));
}
} catch (e) {
logError('GetEmailContentInteractor::_getContentEmailFromServer():EXCEPTION: $e');
logWarning('GetEmailContentInteractor::_getContentEmailFromServer():EXCEPTION: $e');
yield Left<Failure, Success>(GetEmailContentFailure(
e,
onRetry: execute(
@@ -149,7 +149,7 @@ class GetEmailContentInteractor {
)
));
} catch (e) {
logError('GetEmailContentInteractor::_getStoredOpenedEmail():EXCEPTION: $e');
logWarning('GetEmailContentInteractor::_getStoredOpenedEmail():EXCEPTION: $e');
yield* _getStoredNewEmail(
session,
accountId,
@@ -190,7 +190,7 @@ class GetEmailContentInteractor {
)
));
} catch (e) {
logError('GetEmailContentInteractor::_getStoredNewEmail():EXCEPTION: $e');
logWarning('GetEmailContentInteractor::_getStoredNewEmail():EXCEPTION: $e');
yield* _getContentEmailFromServer(
session,
accountId,
@@ -59,7 +59,7 @@ class SaveTemplateEmailInteractor {
yield Right(SaveTemplateEmailSuccess(emailTemplateSaved.id!));
}
} catch (e) {
logError('SaveTemplateEmailInteractor::execute(): $e');
logWarning('SaveTemplateEmailInteractor::execute(): $e');
if (createEmailRequest.templateEmailId != null) {
yield Left(UpdateTemplateEmailFailure(exception: e));
} else {
@@ -76,7 +76,7 @@ class SaveTemplateEmailInteractor {
isTemplate: true);
return emailCreated;
} catch (e) {
logError('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e');
logWarning('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e');
return null;
}
}
@@ -41,7 +41,7 @@ class StoreListNewEmailInteractor {
await _emailRepository.getStoredNewEmail(session, accountId, detailedEmail.emailId);
return true;
} catch (err) {
logError('StoreNewEmailInteractor::_isNewEmailAlreadyStored():EXCEPTION: $err');
logWarning('StoreNewEmailInteractor::_isNewEmailAlreadyStored():EXCEPTION: $err');
return false;
}
}
@@ -39,7 +39,7 @@ class StoreOpenedEmailInteractor {
await _emailRepository.getStoredOpenedEmail(session, accountId, detailedEmail.emailId);
return true;
} catch (err) {
logError('StoreOpenedEmailInteractor::isOpenedEmailAlreadyStored():EXCEPTION: $err');
logWarning('StoreOpenedEmailInteractor::isOpenedEmailAlreadyStored():EXCEPTION: $err');
return false;
}
}
@@ -482,7 +482,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
transformConfiguration
));
} catch (e) {
logError('SingleEmailController::_getEmailContentAction(): $e');
logWarning('SingleEmailController::_getEmailContentAction(): $e');
consumeState(Stream.value(Left(GetEmailContentFailure(
e,
onRetry: e is UnknownUriException
@@ -15,7 +15,7 @@ extension HandleOpenAttachmentListExtension on SingleEmailController {
}) {
final scrollController = threadDetailController?.scrollController;
if (scrollController == null || !scrollController.hasClients) {
logError(
logWarning(
'$runtimeType::jumpToAttachmentList(): scrollController is null');
return;
}
@@ -106,7 +106,7 @@ class EmailUtils {
MailAddress mailAddress = MailAddress.validateAddress(address);
return GetUtils.isEmail(mailAddress.stripDetails().asString()) && mailAddress.asString().isNotEmpty;
} catch(e) {
logError('EmailUtils::isEmailAddressValid: Exception = $e');
logWarning('EmailUtils::isEmailAddressValid: Exception = $e');
return false;
}
}
@@ -137,7 +137,7 @@ class EmailUtils {
return matches.map((match) => match.group(1)!).toList();
} catch (e) {
logError('EmailUtils::extractMailtoLinksFromListPost:Exception = $e');
logWarning('EmailUtils::extractMailtoLinksFromListPost:Exception = $e');
return [];
}
}
@@ -174,7 +174,7 @@ class EmailUtils {
bccMailAddresses: bccMailAddresses
);
} catch (e) {
logError('EmailUtils::extractRecipientsFromListMailtoLink:Exception = $e');
logWarning('EmailUtils::extractRecipientsFromListMailtoLink:Exception = $e');
return (
toMailAddresses: [],
ccMailAddresses: [],
@@ -207,7 +207,7 @@ class EmailUtils {
bccMailAddresses: navigationRouter.bcc ?? [],
);
} catch (e) {
logError('EmailUtils::extractRecipientsFromMailtoLink:Exception = $e');
logWarning('EmailUtils::extractRecipientsFromMailtoLink:Exception = $e');
return (
toMailAddresses: [],
ccMailAddresses: [],
@@ -240,7 +240,7 @@ class EmailUtils {
type: type?.isNotEmpty == true ? MediaType.parse(type!) : null,
);
} catch (e) {
logError('EmailUtils::parsingAttachmentByUri:Exception = $e:');
logWarning('EmailUtils::parsingAttachmentByUri:Exception = $e:');
return null;
}
}
@@ -329,7 +329,7 @@ class EmailUtils {
MailAddress mailAddress = MailAddress.validateAddress(emailAddress);
return mailAddress.domain.asString();
} catch (e) {
logError('EmailUtils::getDomainByEmailAddress:Exception is $e');
logWarning('EmailUtils::getDomainByEmailAddress:Exception is $e');
return '';
}
}
@@ -161,7 +161,7 @@ class _PDFViewerState extends State<PDFViewer> {
previewerOptions: PreviewerOptions(
previewerState: previewerState,
onError: (error) {
logError('_PDFViewerState::build:openData:onError:: $error');
logWarning('_PDFViewerState::build:openData:onError:: $error');
_pdfViewStateNotifier.value = DownloadAttachmentForWebFailure(exception: error);
},
errorMessage: AppLocalizations.of(context).noPreviewAvailable,