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
@@ -143,7 +143,7 @@ class DownloadManager {
); );
} }
} catch (exception) { } catch (exception) {
logError('DownloadManager::openDownloadedFileWeb(): ERROR: $exception'); logWarning('DownloadManager::openDownloadedFileWeb(): ERROR: $exception');
rethrow; rethrow;
} }
} }
@@ -153,7 +153,7 @@ class DownloadManager {
final contentType = responseBody.headers[Headers.contentTypeHeader]; final contentType = responseBody.headers[Headers.contentTypeHeader];
return MediaType.parse(contentType!.first); return MediaType.parse(contentType!.first);
} catch (e) { } catch (e) {
logError('DownloadManager::_extractMediaTypeFromResponse(): $e'); logWarning('DownloadManager::_extractMediaTypeFromResponse(): $e');
return null; return null;
} }
} }
@@ -37,7 +37,7 @@ extension StringExtension on String {
} }
} }
} catch (e) { } catch (e) {
logError('StringExtension::firstLetterToUpperCase(): $e'); logWarning('StringExtension::firstLetterToUpperCase(): $e');
return ''; return '';
} }
} }
@@ -94,7 +94,7 @@ extension StringExtension on String {
return 0; return 0;
} }
} catch (e) { } catch (e) {
logError('StringExtension::_generateGradientColorIndex(): $e'); logWarning('StringExtension::_generateGradientColorIndex(): $e');
return 0; return 0;
} }
} }
@@ -26,7 +26,7 @@ extension URIExtension on Uri {
try { try {
return origin.isNotEmpty; return origin.isNotEmpty;
} catch (e) { } catch (e) {
logError('URIExtension::hasOrigin:Exception = $e'); logWarning('URIExtension::hasOrigin:Exception = $e');
return false; return false;
} }
} }
@@ -46,7 +46,7 @@ abstract class DomTransformer {
return null; return null;
} }
} catch (e) { } catch (e) {
logError('DomTransformer::findImageUrlFromStyleTag:Exception: $e'); logWarning('DomTransformer::findImageUrlFromStyleTag:Exception: $e');
return null; return null;
} }
} }
@@ -28,7 +28,7 @@ class AddLazyLoadingForBackgroundImageTransformer extends DomTransformer {
} }
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -36,7 +36,7 @@ class BlockCodeTransformer extends DomTransformer {
'''; ''';
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -29,7 +29,7 @@ class BlockQuotedTransformer extends DomTransformer {
'''; ''';
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -27,7 +27,7 @@ class HideDraftSignatureTransformer extends DomTransformer {
signature.attributes['style'] = '$currentStyle; display: none;'; signature.attributes['style'] = '$currentStyle; display: none;';
} }
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -52,7 +52,7 @@ class ImageTransformer extends DomTransformer {
} }
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
@@ -48,7 +48,7 @@ class NormalizeLineHeightInStyleTransformer extends DomTransformer {
} }
} }
} catch (e) { } catch (e) {
logError('$runtimeType::process: Exception = $e'); logWarning('$runtimeType::process: Exception = $e');
} }
} }
} }
@@ -23,7 +23,7 @@ class RemoveCollapsedSignatureButtonTransformer extends DomTransformer {
element.remove(); element.remove();
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -31,7 +31,7 @@ class RemoveLazyLoadingForBackgroundImageTransformer extends DomTransformer {
element.attributes.remove('lazy'); element.attributes.remove('lazy');
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -21,7 +21,7 @@ class RemoveLazyLoadingImageTransformer extends DomTransformer {
element.attributes.remove('loading'); element.attributes.remove('loading');
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -26,7 +26,7 @@ class RemoveMaxWidthInImageStyleTransformer extends DomTransformer {
} }
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -22,7 +22,7 @@ class RemoveStyleTagOutsideTransformer extends DomTransformer {
element.remove(); element.remove();
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -26,7 +26,7 @@ class SanitizeHyperLinkTagInHtmlTransformer extends DomTransformer {
_addNoReferrerForRelProperty(element); _addNoReferrerForRelProperty(element);
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
@@ -23,7 +23,7 @@ class RemoveScriptTransformer extends DomTransformer {
scriptElement.remove(); scriptElement.remove();
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -23,7 +23,7 @@ class SignatureTransformer extends DomTransformer {
element.attributes['class'] = 'tmail-signature-blocked'; element.attributes['class'] = 'tmail-signature-blocked';
})); }));
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
} }
} }
} }
@@ -56,7 +56,7 @@ class SanitizeAutolinkFilter {
log('SanitizeAutolinkFilter::process:htmlTextBuffer = $textSanitized'); log('SanitizeAutolinkFilter::process:htmlTextBuffer = $textSanitized');
return textSanitized; return textSanitized;
} catch (e) { } catch (e) {
logError('$runtimeType::process:Exception = $e'); logWarning('$runtimeType::process:Exception = $e');
return inputText; return inputText;
} }
} }
@@ -24,7 +24,7 @@ class SanitizeUrl {
} }
return originalUrl; return originalUrl;
} catch (e) { } catch (e) {
logError('SanitizeUrl::process:Exception = $e'); logWarning('SanitizeUrl::process:Exception = $e');
return inputText; return inputText;
} }
} }
@@ -166,7 +166,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
_handleHyperLinkEvent(data['url']); _handleHyperLinkEvent(data['url']);
} }
} catch (e) { } catch (e) {
logError('$runtimeType::_handleMessageEvent:Exception = $e'); logWarning('$runtimeType::_handleMessageEvent:Exception = $e');
} }
} }
@@ -212,7 +212,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
} }
} }
} catch (e) { } catch (e) {
logError('$runtimeType::_handleIframeOnScrollChangedListener:Exception = $e'); logWarning('$runtimeType::_handleIframeOnScrollChangedListener:Exception = $e');
} }
} }
@@ -309,7 +309,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
log('$runtimeType::_handleOnIFrameKeyboardEvent:📥 Shortcut pressed: $shortcut'); log('$runtimeType::_handleOnIFrameKeyboardEvent:📥 Shortcut pressed: $shortcut');
widget.onIFrameKeyboardShortcutAction?.call(shortcut); widget.onIFrameKeyboardShortcutAction?.call(shortcut);
} catch (e) { } catch (e) {
logError('$runtimeType::_handleOnIFrameKeyboardEvent: Exception = $e'); logWarning('$runtimeType::_handleOnIFrameKeyboardEvent: Exception = $e');
} }
} }
@@ -323,7 +323,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
log('$runtimeType::_handleOnIFrameClickEvent: $data'); log('$runtimeType::_handleOnIFrameClickEvent: $data');
widget.onIFrameClickAction?.call(); widget.onIFrameClickAction?.call();
} catch (e) { } catch (e) {
logError('$runtimeType::_handleOnIFrameClickEvent: Exception = $e'); logWarning('$runtimeType::_handleOnIFrameClickEvent: Exception = $e');
} }
} }
@@ -354,7 +354,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
} }
} }
} catch (e) { } catch (e) {
logError('$runtimeType::_handleOnIFrameLinkHoverEvent: Exception = $e'); logWarning('$runtimeType::_handleOnIFrameLinkHoverEvent: Exception = $e');
} }
} }
@@ -363,7 +363,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
log('$runtimeType::_handleOnIFrameLinkOutEvent: $data'); log('$runtimeType::_handleOnIFrameLinkOutEvent: $data');
_tooltipOverlay?.hide(); _tooltipOverlay?.hide();
} catch (e) { } catch (e) {
logError('$runtimeType::_handleOnIFrameLinkOutEvent: Exception = $e'); logWarning('$runtimeType::_handleOnIFrameLinkOutEvent: Exception = $e');
} }
} }
@@ -411,7 +411,7 @@ class HtmlContentViewState extends State<HtmlContentViewer> with AutomaticKeepAl
try { try {
_webViewController.dispose(); _webViewController.dispose();
} catch (e) { } catch (e) {
logError('_HtmlContentViewState:dispose:_webViewController.dispose: $e'); logWarning('_HtmlContentViewState:dispose:_webViewController.dispose: $e');
} }
} else { } else {
_webViewController.dispose(); _webViewController.dispose();
@@ -111,7 +111,7 @@ class QuickSearchSuggestionListState<T, P, R>
try { try {
return await widget.fetchRecentActionCallback?.call(queryString); return await widget.fetchRecentActionCallback?.call(queryString);
} catch (e) { } catch (e) {
logError('SuggestionsListState::_getRecent:Exception = $e'); logWarning('SuggestionsListState::_getRecent:Exception = $e');
return null; return null;
} }
} }
@@ -120,7 +120,7 @@ class QuickSearchSuggestionListState<T, P, R>
try { try {
return await widget.contactSuggestionCallback?.call(queryString); return await widget.contactSuggestionCallback?.call(queryString);
} catch (e) { } catch (e) {
logError('SuggestionsListState::_getListContact:Exception = $e'); logWarning('SuggestionsListState::_getListContact:Exception = $e');
return null; return null;
} }
} }
@@ -129,7 +129,7 @@ class QuickSearchSuggestionListState<T, P, R>
try { try {
return await widget.suggestionsCallback?.call(queryString); return await widget.suggestionsCallback?.call(queryString);
} catch (e) { } catch (e) {
logError('SuggestionsListState::_getListSuggestion:Exception = $e'); logWarning('SuggestionsListState::_getListSuggestion:Exception = $e');
return null; return null;
} }
} }
+22 -21
View File
@@ -16,7 +16,7 @@ const appLogName = '[TwakeMail]';
String _applyWebColor(Level level, String text) { String _applyWebColor(Level level, String text) {
switch (level) { switch (level) {
case Level.wtf: case Level.critical:
return '$ansiRed$ansiBold!!!CRITICAL!!! $text$ansiReset'; return '$ansiRed$ansiBold!!!CRITICAL!!! $text$ansiReset';
case Level.error: case Level.error:
return '$ansiRed$text$ansiReset'; return '$ansiRed$text$ansiReset';
@@ -26,14 +26,14 @@ String _applyWebColor(Level level, String text) {
return '$ansiGreen$text$ansiReset'; return '$ansiGreen$text$ansiReset';
case Level.debug: case Level.debug:
return '$ansiBlue$text$ansiReset'; return '$ansiBlue$text$ansiReset';
case Level.verbose: case Level.trace:
return text; return text;
} }
} }
String _applyMobileFormat(Level level, String text) { String _applyMobileFormat(Level level, String text) {
switch (level) { switch (level) {
case Level.wtf: case Level.critical:
return '🔥 CRITICAL: $text'; return '🔥 CRITICAL: $text';
case Level.error: case Level.error:
return '❌ ERROR: $text'; return '❌ ERROR: $text';
@@ -43,7 +43,7 @@ String _applyMobileFormat(Level level, String text) {
return '️ INFO: $text'; return '️ INFO: $text';
case Level.debug: case Level.debug:
return '🐛 DEBUG: $text'; return '🐛 DEBUG: $text';
case Level.verbose: case Level.trace:
return '🔍 VERBOSE: $text'; return '🔍 VERBOSE: $text';
} }
} }
@@ -56,13 +56,22 @@ void _internalLog(
Map<String, dynamic>? extras, Map<String, dynamic>? extras,
bool webConsoleEnabled = false, bool webConsoleEnabled = false,
}) { }) {
final shouldPrint = webConsoleEnabled
? PlatformInfo.isWeb
: BuildUtils.isDebugMode;
if (!shouldPrint) {
return;
}
final rawMessage = _buildRawMessage(message, exception, extras, stackTrace); final rawMessage = _buildRawMessage(message, exception, extras, stackTrace);
final formattedMessage = _formatMessage(level, rawMessage); final formattedMessage = _formatMessage(level, rawMessage);
if (webConsoleEnabled && PlatformInfo.isWeb) { if (webConsoleEnabled && PlatformInfo.isWeb) {
_printWebConsole(level, formattedMessage); _printWebConsole(level, formattedMessage);
} else { } else {
_debugPrint(formattedMessage); // ignore: avoid_print
print('$appLogName $formattedMessage');
} }
} }
@@ -80,24 +89,16 @@ String _buildRawMessage(
return parts.join(' | '); return parts.join(' | ');
} }
String _formatMessage(Level level, String raw) { String _formatMessage(Level level, String raw) {
return PlatformInfo.isWeb return PlatformInfo.isWeb
? _applyWebColor(level, raw) ? _applyWebColor(level, raw)
: _applyMobileFormat(level, raw); : _applyMobileFormat(level, raw);
} }
void _debugPrint(String formatted) {
if (!BuildUtils.isDebugMode) return;
// ignore: avoid_print
print('$appLogName $formatted');
}
void _printWebConsole(Level level, String value) { void _printWebConsole(Level level, String value) {
switch (level) { switch (level) {
case Level.error: case Level.error:
case Level.wtf: case Level.critical:
html.window.console.error('$appLogName $value'); html.window.console.error('$appLogName $value');
break; break;
case Level.warning: case Level.warning:
@@ -107,7 +108,7 @@ void _printWebConsole(Level level, String value) {
html.window.console.info('$appLogName $value'); html.window.console.info('$appLogName $value');
break; break;
case Level.debug: case Level.debug:
case Level.verbose: case Level.trace:
html.window.console.debug('$appLogName $value'); html.window.console.debug('$appLogName $value');
break; break;
} }
@@ -130,7 +131,7 @@ void logError(
); );
} }
void logWTF( void logCritical(
String? message, { String? message, {
Object? exception, Object? exception,
StackTrace? stackTrace, StackTrace? stackTrace,
@@ -139,7 +140,7 @@ void logWTF(
}) { }) {
_internalLog( _internalLog(
message, message,
level: Level.wtf, level: Level.critical,
exception: exception, exception: exception,
stackTrace: stackTrace, stackTrace: stackTrace,
extras: extras, extras: extras,
@@ -177,13 +178,13 @@ void logDebug(
); );
} }
void logVerbose( void logTrace(
String? message, { String? message, {
bool webConsoleEnabled = false, bool webConsoleEnabled = false,
}) { }) {
_internalLog( _internalLog(
message, message,
level: Level.verbose, level: Level.trace,
webConsoleEnabled: webConsoleEnabled, webConsoleEnabled: webConsoleEnabled,
); );
} }
@@ -198,12 +199,12 @@ void log(
); );
enum Level { enum Level {
wtf, critical,
error, error,
warning, warning,
info, info,
debug, debug,
verbose, trace,
} }
// Take from: https://flutter.dev/docs/testing/errors // Take from: https://flutter.dev/docs/testing/errors
+1 -1
View File
@@ -35,7 +35,7 @@ class ApplicationManager {
log('ApplicationManager::getUserAgent: $userAgent'); log('ApplicationManager::getUserAgent: $userAgent');
return userAgent; return userAgent;
} catch(e) { } catch(e) {
logError('ApplicationManager::getUserAgent: Exception: $e'); logWarning('ApplicationManager::getUserAgent: Exception: $e');
return ''; return '';
} }
} }
+4 -4
View File
@@ -97,7 +97,7 @@ class FileUtils {
log('FileUtils::getFolder(): $folderPath'); log('FileUtils::getFolder(): $folderPath');
return Directory(folderPath); return Directory(folderPath);
} catch (e) { } catch (e) {
logError('FileUtils::getFolder():EXCEPTION: $e'); logWarning('FileUtils::getFolder():EXCEPTION: $e');
return null; return null;
} }
} }
@@ -113,7 +113,7 @@ class FileUtils {
log('FileUtils::removeFolder: Remove ${dir.path} success'); log('FileUtils::removeFolder: Remove ${dir.path} success');
} }
} catch (e) { } catch (e) {
logError('FileUtils::removeFolder():EXCEPTION: $e'); logWarning('FileUtils::removeFolder():EXCEPTION: $e');
} }
} }
@@ -134,7 +134,7 @@ class FileUtils {
await file.delete(); await file.delete();
} }
} catch (e) { } catch (e) {
logError('$runtimeType::deleteCompressedFileOnMobile: error: $e'); logWarning('$runtimeType::deleteCompressedFileOnMobile: error: $e');
} }
} }
@@ -144,7 +144,7 @@ class FileUtils {
log('FileUtils::getCharsetFromBytes: FILE_CHARSET = ${decodedResult.charset}'); log('FileUtils::getCharsetFromBytes: FILE_CHARSET = ${decodedResult.charset}');
return decodedResult.charset; return decodedResult.charset;
} catch (e) { } catch (e) {
logError('FileUtils::getCharsetFromBytes: Exception: $e'); logWarning('FileUtils::getCharsetFromBytes: Exception: $e');
return DEFAULT_CHARSET; return DEFAULT_CHARSET;
} }
} }
+5 -5
View File
@@ -671,7 +671,7 @@ class HtmlUtils {
return true; return true;
} catch (e) { } catch (e) {
logError('AppUtils::openNewWindowByUrl:Exception = $e'); logWarning('AppUtils::openNewWindowByUrl:Exception = $e');
return false; return false;
} }
} }
@@ -683,7 +683,7 @@ class HtmlUtils {
titleElements.first.text = title; titleElements.first.text = title;
} }
} catch (e) { } catch (e) {
logError('AppUtils::setWindowBrowserTitle:Exception = $e'); logWarning('AppUtils::setWindowBrowserTitle:Exception = $e');
} }
} }
@@ -691,7 +691,7 @@ class HtmlUtils {
try { try {
return htmlUnescape.convert(input); return htmlUnescape.convert(input);
} catch (e) { } catch (e) {
logError('HtmlUtils::unescapeHtml:Exception = $e'); logWarning('HtmlUtils::unescapeHtml:Exception = $e');
return input; return input;
} }
} }
@@ -718,7 +718,7 @@ class HtmlUtils {
log('HtmlUtils::isOldSafari:Version = $version'); log('HtmlUtils::isOldSafari:Version = $version');
return version != null && version < 17; return version != null && version < 17;
} catch (e) { } catch (e) {
logError('HtmlUtils::isOldSafari:Exception = $e'); logWarning('HtmlUtils::isOldSafari:Exception = $e');
return false; return false;
} }
} }
@@ -893,7 +893,7 @@ class HtmlUtils {
return container.innerHtml; return container.innerHtml;
} catch (e) { } catch (e) {
logError('HtmlUtils::wrapPlainTextLinks:Exception = $e'); logWarning('HtmlUtils::wrapPlainTextLinks:Exception = $e');
return htmlString; return htmlString;
} }
} }
+1 -1
View File
@@ -70,7 +70,7 @@ class Domain with EquatableMixin {
InternetAddress(value); InternetAddress(value);
return true; return true;
} catch (e) { } catch (e) {
logError('Domain::validIPAddress: Exception = $e'); logWarning('Domain::validIPAddress: Exception = $e');
return false; return false;
} }
} }
+1 -1
View File
@@ -100,7 +100,7 @@ class MailAddress with EquatableMixin {
throw AddressException('No domain found at position ${pos + 1} in "$address"'); throw AddressException('No domain found at position ${pos + 1} in "$address"');
} }
} catch (e) { } catch (e) {
logError('MailAddress::validate: Exception = $e'); logWarning('MailAddress::validate: Exception = $e');
if (e is AddressException) { if (e is AddressException) {
rethrow; rethrow;
} else { } else {
+3 -3
View File
@@ -65,7 +65,7 @@ class PreviewEmlFileUtils {
${listAttachment?.isNotEmpty == true ? _createAttachmentsElement(listAttachment: listAttachment ?? [], titleAttachment: titleAttachment) : ''} ${listAttachment?.isNotEmpty == true ? _createAttachmentsElement(listAttachment: listAttachment ?? [], titleAttachment: titleAttachment) : ''}
'''); ''');
} catch (e) { } catch (e) {
logError('PreviewEmlFileUtils::_createEmailElement: Exception = $e'); logWarning('PreviewEmlFileUtils::_createEmailElement: Exception = $e');
return null; return null;
} }
} }
@@ -78,7 +78,7 @@ class PreviewEmlFileUtils {
</div> </div>
'''; ''';
} catch (e) { } catch (e) {
logError('PreviewEmlFileUtils::_createRecipientHtmlTag: Exception = $e'); logWarning('PreviewEmlFileUtils::_createRecipientHtmlTag: Exception = $e');
return ''; return '';
} }
} }
@@ -127,7 +127,7 @@ class PreviewEmlFileUtils {
</div> </div>
'''; ''';
} catch (e) { } catch (e) {
logError('PreviewEmlFileUtils::_createAttachmentsElement: Exception = $e'); logWarning('PreviewEmlFileUtils::_createAttachmentsElement: Exception = $e');
return ''; return '';
} }
} }
+8 -8
View File
@@ -35,7 +35,7 @@ class PrintUtils {
</table> </table>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createUserInformationElement: Exception = $e'); logWarning('PrintUtils::_createUserInformationElement: Exception = $e');
return null; return null;
} }
} }
@@ -44,7 +44,7 @@ class PrintUtils {
try { try {
return Element.html('<hr />'); return Element.html('<hr />');
} catch (e) { } catch (e) {
logError('PrintUtils::dividerElement: Exception = $e'); logWarning('PrintUtils::dividerElement: Exception = $e');
return null; return null;
} }
} }
@@ -63,7 +63,7 @@ class PrintUtils {
</table> </table>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createSubjectElement: Exception = $e'); logWarning('PrintUtils::_createSubjectElement: Exception = $e');
return null; return null;
} }
} }
@@ -88,7 +88,7 @@ class PrintUtils {
</table> </table>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createSenderElement: Exception = $e'); logWarning('PrintUtils::_createSenderElement: Exception = $e');
return null; return null;
} }
} }
@@ -99,7 +99,7 @@ class PrintUtils {
element.text = '$prefix: $emailAddress'; element.text = '$prefix: $emailAddress';
return element.outerHtml; return element.outerHtml;
} catch (e) { } catch (e) {
logError('PrintUtils::_createRecipientHtmlTag: Exception = $e'); logWarning('PrintUtils::_createRecipientHtmlTag: Exception = $e');
return ''; return '';
} }
} }
@@ -126,7 +126,7 @@ class PrintUtils {
</tr> </tr>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createRecipientsElement: Exception = $e'); logWarning('PrintUtils::_createRecipientsElement: Exception = $e');
return null; return null;
} }
} }
@@ -147,7 +147,7 @@ class PrintUtils {
</tr> </tr>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createEmailContentElement: Exception = $e'); logWarning('PrintUtils::_createEmailContentElement: Exception = $e');
return null; return null;
} }
} }
@@ -198,7 +198,7 @@ class PrintUtils {
</table> </table>
'''); ''');
} catch (e) { } catch (e) {
logError('PrintUtils::_createAttachmentsElement: Exception = $e'); logWarning('PrintUtils::_createAttachmentsElement: Exception = $e');
return null; return null;
} }
} }
+3 -3
View File
@@ -51,7 +51,7 @@ class StringConvert {
try { try {
return utf8.decode(base64Decode(text)); return utf8.decode(base64Decode(text));
} catch (e) { } catch (e) {
logError('StringConvert::decodeBase64ToString:Exception = $e'); logWarning('StringConvert::decodeBase64ToString:Exception = $e');
return text; return text;
} }
} }
@@ -136,7 +136,7 @@ class StringConvert {
log('StringConvert::getMediaTypeFromBase64ImageTag:mimeType = $mimeType'); log('StringConvert::getMediaTypeFromBase64ImageTag:mimeType = $mimeType');
return MediaType.parse(mimeType); return MediaType.parse(mimeType);
} catch (e) { } catch (e) {
logError('StringConvert::getMimeTypeFromBase64ImageTag:Exception = $e'); logWarning('StringConvert::getMimeTypeFromBase64ImageTag:Exception = $e');
return null; return null;
} }
} }
@@ -147,7 +147,7 @@ class StringConvert {
final contentOriginal = emailDocument.body?.innerHtml ?? content; final contentOriginal = emailDocument.body?.innerHtml ?? content;
return contentOriginal; return contentOriginal;
} catch (e) { } catch (e) {
logError('StringConvert::getContentOriginal:Exception = $e'); logWarning('StringConvert::getContentOriginal:Exception = $e');
return content; return content;
} }
} }
+1 -1
View File
@@ -82,7 +82,7 @@ class WebLinkGenerator {
searchParams: searchParams, searchParams: searchParams,
); );
} catch (e) { } catch (e) {
logError('[WebLinkGenerator] Error: $e'); logWarning('[WebLinkGenerator] Error: $e');
return ''; return '';
} }
} }
@@ -207,7 +207,7 @@ mixin ScenarioUtilsMixin {
attachments.add(attachment); attachments.add(attachment);
} }
} catch (e) { } catch (e) {
logError('ScenarioUtilsMixin::uploadAttachments(): $e'); logWarning('ScenarioUtilsMixin::uploadAttachments(): $e');
return attachments; return attachments;
} }
} }
+17 -14
View File
@@ -143,7 +143,7 @@ abstract class BaseController extends GetxController
} }
void onError(dynamic error, StackTrace stackTrace) { void onError(dynamic error, StackTrace stackTrace) {
logError('$runtimeType::onError():Error: $error | StackTrace: $stackTrace'); logWarning('$runtimeType::onError():Error: $error | StackTrace: $stackTrace');
final isUrgentException = validateUrgentException(error); final isUrgentException = validateUrgentException(error);
if (isUrgentException) { if (isUrgentException) {
handleUrgentException(exception: error); handleUrgentException(exception: error);
@@ -173,7 +173,7 @@ abstract class BaseController extends GetxController
} }
void handleUrgentExceptionOnMobile({Failure? failure, Exception? exception}) { void handleUrgentExceptionOnMobile({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnMobile():Failure: $failure | Exception: $exception'); logWarning('$runtimeType::handleUrgentExceptionOnMobile():Failure: $failure | Exception: $exception');
if (exception is ConnectionError) { if (exception is ConnectionError) {
_handleConnectionErrorException(); _handleConnectionErrorException();
} else if (exception is BadCredentialsException) { } else if (exception is BadCredentialsException) {
@@ -182,7 +182,7 @@ abstract class BaseController extends GetxController
} }
void handleUrgentExceptionOnWeb({Failure? failure, Exception? exception}) { void handleUrgentExceptionOnWeb({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnWeb():Failure: $failure | Exception: $exception'); logWarning('$runtimeType::handleUrgentExceptionOnWeb():Failure: $failure | Exception: $exception');
if (exception is NoNetworkError) { if (exception is NoNetworkError) {
_handleNotNetworkErrorException(); _handleNotNetworkErrorException();
} else if (exception is ConnectionError) { } else if (exception is ConnectionError) {
@@ -258,7 +258,7 @@ abstract class BaseController extends GetxController
} }
void handleFailureViewState(Failure failure) async { void handleFailureViewState(Failure failure) async {
logError('$runtimeType::handleFailureViewState():Failure = $failure'); logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
if (failure is LogoutOidcFailure) { if (failure is LogoutOidcFailure) {
if (_isFcmEnabled) { if (_isFcmEnabled) {
_getStoredFirebaseRegistrationFromCache(); _getStoredFirebaseRegistrationFromCache();
@@ -313,7 +313,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [tmailContactCapabilityIdentifier]); requireCapability(session!, accountId!, [tmailContactCapabilityIdentifier]);
TMailAutoCompleteBindings().dependencies(); TMailAutoCompleteBindings().dependencies();
} catch (e) { } catch (e) {
logError('$runtimeType::injectAutoCompleteBindings(): exception: $e'); logWarning('$runtimeType::injectAutoCompleteBindings(): exception: $e');
} }
} }
@@ -322,7 +322,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [CapabilityIdentifier.jmapMdn]); requireCapability(session!, accountId!, [CapabilityIdentifier.jmapMdn]);
MdnInteractorBindings().dependencies(); MdnInteractorBindings().dependencies();
} catch(e) { } catch(e) {
logError('$runtimeType::injectMdnBindings(): exception: $e'); logWarning('$runtimeType::injectMdnBindings(): exception: $e');
} }
} }
@@ -331,7 +331,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [capabilityForward]); requireCapability(session!, accountId!, [capabilityForward]);
ForwardingInteractorsBindings().dependencies(); ForwardingInteractorsBindings().dependencies();
} catch(e) { } catch(e) {
logError('$runtimeType::injectForwardBindings(): exception: $e'); logWarning('$runtimeType::injectForwardBindings(): exception: $e');
} }
} }
@@ -340,7 +340,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [capabilityRuleFilter]); requireCapability(session!, accountId!, [capabilityRuleFilter]);
EmailRulesInteractorBindings().dependencies(); EmailRulesInteractorBindings().dependencies();
} catch(e) { } catch(e) {
logError('$runtimeType::injectRuleFilterBindings(): exception: $e'); logWarning('$runtimeType::injectRuleFilterBindings(): exception: $e');
} }
} }
@@ -362,7 +362,7 @@ abstract class BaseController extends GetxController
throw NotSupportFCMException(); throw NotSupportFCMException();
} }
} catch(e) { } catch(e) {
logError('$runtimeType::injectFCMBindings(): exception: $e'); logWarning('$runtimeType::injectFCMBindings(): exception: $e');
} }
} }
@@ -386,7 +386,7 @@ abstract class BaseController extends GetxController
WebSocketInteractorBindings().dependencies(); WebSocketInteractorBindings().dependencies();
WebSocketController.instance.initialize(accountId: accountId, session: session); WebSocketController.instance.initialize(accountId: accountId, session: session);
} catch(e) { } catch(e) {
logError('$runtimeType::injectWebSocket(): exception: $e'); logWarning('$runtimeType::injectWebSocket(): exception: $e');
} }
} }
@@ -491,7 +491,7 @@ abstract class BaseController extends GetxController
onSuccessCallback(); onSuccessCallback();
} }
} catch (e) { } catch (e) {
logError('BaseController::logoutToSignInNewAccount:Exception = $e'); logWarning('BaseController::logoutToSignInNewAccount:Exception = $e');
onFailureCallback(); onFailureCallback();
} }
} }
@@ -510,8 +510,11 @@ abstract class BaseController extends GetxController
} }
Future<void> _handleDeleteFCMRegistration() async { Future<void> _handleDeleteFCMRegistration() async {
_getStoredFirebaseRegistrationInteractor =
getBinding<GetStoredFirebaseRegistrationInteractor>();
if (_getStoredFirebaseRegistrationInteractor == null) return;
try { try {
_getStoredFirebaseRegistrationInteractor = getBinding<GetStoredFirebaseRegistrationInteractor>();
final fcmRegistration = await _getStoredFirebaseRegistrationInteractor?.execute().last; final fcmRegistration = await _getStoredFirebaseRegistrationInteractor?.execute().last;
fcmRegistration?.foldSuccess<GetStoredFirebaseRegistrationSuccess>( fcmRegistration?.foldSuccess<GetStoredFirebaseRegistrationSuccess>(
@@ -522,7 +525,7 @@ abstract class BaseController extends GetxController
onFailure: (failure) {}, onFailure: (failure) {},
); );
} catch (e) { } catch (e) {
logError('BaseController::_handleDeleteFCMRegistration:Exception = $e'); logWarning('BaseController::_handleDeleteFCMRegistration:Exception = $e');
} }
} }
@@ -563,7 +566,7 @@ abstract class BaseController extends GetxController
await _clearBasicAuthData(); await _clearBasicAuthData();
} }
} catch (e) { } catch (e) {
logError('BaseController::clearAllData:Exception = $e'); logWarning('BaseController::clearAllData:Exception = $e');
} }
} }
@@ -19,6 +19,6 @@ class BeforeReconnectManager {
Future<void> executeBeforeReconnectListeners() async { Future<void> executeBeforeReconnectListeners() async {
await Future.wait(_listeners.map((listener) => listener.call())) await Future.wait(_listeners.map((listener) => listener.call()))
.onError((error, stackTrace) => [logError(error.toString())]); .onError((error, stackTrace) => [logWarning(error.toString())]);
} }
} }
@@ -21,7 +21,7 @@ abstract class IsolateManager {
IsolateNameServer.registerPortWithName(_eventReceivePort.sendPort, isolateIdentityName); IsolateNameServer.registerPortWithName(_eventReceivePort.sendPort, isolateIdentityName);
_streamSubscription = _eventReceivePort.listen(onData, onError: onError, onDone: onDone); _streamSubscription = _eventReceivePort.listen(onData, onError: onError, onDone: onDone);
} catch (e) { } catch (e) {
logError('IsolateManager::initial():EXCEPTION: $e'); logWarning('IsolateManager::initial():EXCEPTION: $e');
} }
} }
@@ -32,10 +32,10 @@ abstract class IsolateManager {
if (sendPort != null) { if (sendPort != null) {
sendPort.send(value); sendPort.send(value);
} else { } else {
logError('IsolateManager::addEvent(): sendPort is null'); logWarning('IsolateManager::addEvent(): sendPort is null');
} }
} catch (e) { } catch (e) {
logError('IsolateManager::addEvent():EXCEPTION: $e'); logWarning('IsolateManager::addEvent():EXCEPTION: $e');
} }
} }
@@ -42,7 +42,7 @@ mixin HandleSetErrorMixin {
handlers!.firstWhere((handler) => handler.call(setError)); handlers!.firstWhere((handler) => handler.call(setError));
return const None<MapEntry<Id, SetError>>(); return const None<MapEntry<Id, SetError>>();
} catch (e) { } catch (e) {
logError('HandleSetErrorMixin::chainHandle(): [Exception] $e'); logWarning('HandleSetErrorMixin::chainHandle(): [Exception] $e');
return Some<MapEntry<Id, SetError>>(setError); return Some<MapEntry<Id, SetError>>(setError);
} }
} }
@@ -50,7 +50,7 @@ mixin HandleSetErrorMixin {
void _handleRemainedError(SetMethodErrorHandler? unCatchErrorHandler, Option<MapEntry<Id, SetError>> optionError) { void _handleRemainedError(SetMethodErrorHandler? unCatchErrorHandler, Option<MapEntry<Id, SetError>> optionError) {
final remainedError = optionError.toNullable(); final remainedError = optionError.toNullable();
if (remainedError != null) { if (remainedError != null) {
logError('HandleSetErrorMixin::_handleRemainedError(): $remainedError'); logWarning('HandleSetErrorMixin::_handleRemainedError(): $remainedError');
unCatchErrorHandler?.call(remainedError); unCatchErrorHandler?.call(remainedError);
} }
} }
@@ -73,7 +73,7 @@ mixin HandleSetErrorMixin {
} }
); );
} }
logError('HandleSetErrorMixin::handleSetResponse():remainedErrors: $remainedErrors'); logWarning('HandleSetErrorMixin::handleSetResponse():remainedErrors: $remainedErrors');
return remainedErrors; return remainedErrors;
} }
} }
@@ -1,8 +1,8 @@
import 'package:core/utils/app_logger.dart';
import 'package:core/utils/platform_info.dart'; import 'package:core/utils/platform_info.dart';
import 'package:core/utils/string_convert.dart'; import 'package:core/utils/string_convert.dart';
import 'package:external_app_launcher/external_app_launcher.dart'; import 'package:external_app_launcher/external_app_launcher.dart';
import 'package:rich_text_composer/views/commons/logger.dart';
import 'package:url_launcher/url_launcher.dart' as launcher; import 'package:url_launcher/url_launcher.dart' as launcher;
mixin LauncherApplicationMixin { mixin LauncherApplicationMixin {
@@ -28,7 +28,7 @@ mixin LauncherApplicationMixin {
await openOtherApplication(uri); await openOtherApplication(uri);
} }
} catch (e) { } catch (e) {
logError('LauncherApplicationMixin::launchApplication:Exception = $e'); logWarning('LauncherApplicationMixin::launchApplication:Exception = $e');
} }
} }
@@ -33,13 +33,13 @@ abstract class ReloadableController extends BaseController {
@override @override
void handleFailureViewState(Failure failure) { void handleFailureViewState(Failure failure) {
if (isNotSignedIn(failure)) { if (isNotSignedIn(failure)) {
logError('$runtimeType::handleFailureViewState():Failure = $failure'); logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
goToLogin(); goToLogin();
} else if (failure is GetSessionFailure) { } else if (failure is GetSessionFailure) {
logError('$runtimeType::handleFailureViewState():Failure = $failure'); logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
handleGetSessionFailure(failure); handleGetSessionFailure(failure);
} else if (failure is UpdateAccountCacheFailure) { } else if (failure is UpdateAccountCacheFailure) {
logError('$runtimeType::handleFailureViewState():Failure = $failure'); logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
_handleUpdateAccountCacheCompleted( _handleUpdateAccountCacheCompleted(
session: failure.session, session: failure.session,
apiUrl: failure.apiUrl); apiUrl: failure.apiUrl);
@@ -153,7 +153,7 @@ abstract class ReloadableController extends BaseController {
requireCapability(session!, accountId!, [CapabilityIdentifier.jmapVacationResponse]); requireCapability(session!, accountId!, [CapabilityIdentifier.jmapVacationResponse]);
VacationInteractorsBindings().dependencies(); VacationInteractorsBindings().dependencies();
} catch(e) { } catch(e) {
logError('$runtimeType::injectVacationBindings(): exception: $e'); logWarning('$runtimeType::injectVacationBindings(): exception: $e');
} }
} }
@@ -33,7 +33,7 @@ class SessionCacheManager extends CacheManagerInteraction {
await _cacheClient.insertMultipleItem(legacyMapItems); await _cacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_cacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_cacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_cacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_cacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -87,7 +87,7 @@ class RecentLoginUrlCacheManager extends CacheManagerInteraction {
await _recentLoginUrlCacheClient.insertMultipleItem(legacyMapItems); await _recentLoginUrlCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentLoginUrlCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentLoginUrlCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentLoginUrlCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentLoginUrlCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -89,7 +89,7 @@ class RecentLoginUsernameCacheManager extends CacheManagerInteraction {
await _recentLoginUsernameCacheClient.insertMultipleItem(legacyMapItems); await _recentLoginUsernameCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentLoginUsernameCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentLoginUsernameCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentLoginUsernameCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentLoginUsernameCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -112,7 +112,7 @@ class RecentSearchCacheManager extends CacheManagerInteraction {
await _recentSearchCacheClient.insertMultipleItem(legacyMapItems); await _recentSearchCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentSearchCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_recentSearchCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentSearchCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_recentSearchCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -102,7 +102,7 @@ class ComposerRepositoryImpl extends ComposerRepository {
uploadUri: uploadUri, uploadUri: uploadUri,
); );
} catch (e) { } catch (e) {
logError('ComposerRepositoryImpl::_replaceImageBase64ToImageCID: Exception: $e'); logWarning('ComposerRepositoryImpl::_replaceImageBase64ToImageCID: Exception: $e');
return Future.value( return Future.value(
Tuple2( Tuple2(
emailContent, emailContent,
@@ -119,7 +119,7 @@ class ComposerRepositoryImpl extends ComposerRepository {
try { try {
return _htmlDataSource.removeCollapsedExpandedSignatureEffect(emailContent: emailContent); return _htmlDataSource.removeCollapsedExpandedSignatureEffect(emailContent: emailContent);
} catch (e) { } catch (e) {
logError('ComposerRepositoryImpl::_removeCollapsedExpandedSignatureEffect: Exception: $e'); logWarning('ComposerRepositoryImpl::_removeCollapsedExpandedSignatureEffect: Exception: $e');
return Future.value(emailContent); return Future.value(emailContent);
} }
} }
@@ -129,7 +129,7 @@ class ComposerRepositoryImpl extends ComposerRepository {
try { try {
return _htmlDataSource.removeStyleLazyLoadDisplayInlineImages(emailContent: emailContent); return _htmlDataSource.removeStyleLazyLoadDisplayInlineImages(emailContent: emailContent);
} catch (e) { } catch (e) {
logError('ComposerRepositoryImpl::removeStyleLazyLoadDisplayInlineImages: Exception: $e'); logWarning('ComposerRepositoryImpl::removeStyleLazyLoadDisplayInlineImages: Exception: $e');
return Future.value(emailContent); return Future.value(emailContent);
} }
} }
@@ -68,7 +68,7 @@ class CreateNewAndSaveEmailToDraftsInteractor {
yield dartz.Left<Failure, Success>(GenerateEmailFailure(CannotCreateEmailObjectException())); yield dartz.Left<Failure, Success>(GenerateEmailFailure(CannotCreateEmailObjectException()));
} }
} catch (e) { } catch (e) {
logError('CreateNewAndSaveEmailToDraftsInteractor::execute: Exception: $e'); logWarning('CreateNewAndSaveEmailToDraftsInteractor::execute: Exception: $e');
if (e is UnknownError && e.message is List<SavingEmailToDraftsCanceledException>) { if (e is UnknownError && e.message is List<SavingEmailToDraftsCanceledException>) {
if (createEmailRequest.draftsEmailId == null) { if (createEmailRequest.draftsEmailId == null) {
yield dartz.Left<Failure, Success>(SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException())); yield dartz.Left<Failure, Success>(SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
@@ -94,7 +94,7 @@ class CreateNewAndSaveEmailToDraftsInteractor {
); );
return emailCreated; return emailCreated;
} catch (e) { } catch (e) {
logError('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e'); logWarning('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e');
return null; return null;
} }
} }
@@ -65,7 +65,7 @@ class CreateNewAndSendEmailInteractor {
yield dartz.Left<Failure, Success>(GenerateEmailFailure(CannotCreateEmailObjectException())); yield dartz.Left<Failure, Success>(GenerateEmailFailure(CannotCreateEmailObjectException()));
} }
} catch (e) { } catch (e) {
logError('CreateNewAndSendEmailInteractor::execute: Exception: $e'); logWarning('CreateNewAndSendEmailInteractor::execute: Exception: $e');
if (e is UnknownError && e.message is List<SendingEmailCanceledException>) { if (e is UnknownError && e.message is List<SendingEmailCanceledException>) {
yield dartz.Left<Failure, Success>(SendEmailFailure( yield dartz.Left<Failure, Success>(SendEmailFailure(
exception: SendingEmailCanceledException(), exception: SendingEmailCanceledException(),
@@ -92,7 +92,7 @@ class CreateNewAndSendEmailInteractor {
final sendingEmailArgument = createEmailRequest.toSendingEmailArguments(emailObject: emailCreated); final sendingEmailArgument = createEmailRequest.toSendingEmailArguments(emailObject: emailCreated);
return sendingEmailArgument; return sendingEmailArgument;
} catch (e) { } catch (e) {
logError('CreateNewAndSendEmailInteractor::_createEmailObject: Exception: $e'); logWarning('CreateNewAndSendEmailInteractor::_createEmailObject: Exception: $e');
return null; return null;
} }
} }
@@ -111,7 +111,7 @@ class CreateNewAndSendEmailInteractor {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('CreateNewAndSendEmailInteractor::_deleteOldDraftsEmail: Exception: $e'); logWarning('CreateNewAndSendEmailInteractor::_deleteOldDraftsEmail: Exception: $e');
} }
} }
} }
@@ -504,7 +504,7 @@ class ComposerController extends BaseController
try { try {
return session.getUploadUri(accountId, jmapUrl: dynamicUrlInterceptors.jmapUrl); return session.getUploadUri(accountId, jmapUrl: dynamicUrlInterceptors.jmapUrl);
} catch (e) { } catch (e) {
logError('ComposerController::_getUploadUriFromSession:Exception = $e'); logWarning('ComposerController::_getUploadUriFromSession:Exception = $e');
return null; return null;
} }
} }
@@ -860,7 +860,7 @@ class ComposerController extends BaseController
? htmlTextEditor!.removeEditorStartTag() ? htmlTextEditor!.removeEditorStartTag()
: ''; : '';
} catch (e) { } catch (e) {
logError('ComposerController::getContentInEditor:Exception = $e'); logWarning('ComposerController::getContentInEditor:Exception = $e');
return ''; return '';
} }
} }
@@ -1105,12 +1105,12 @@ class ComposerController extends BaseController
resultState: value, resultState: value,
queryString: queryString, queryString: queryString,
onFailureCallback: (failure) { onFailureCallback: (failure) {
logError('ComposerController::getAutoCompleteSuggestion:onFailureCallback: $failure'); logWarning('ComposerController::getAutoCompleteSuggestion:onFailureCallback: $failure');
consumeState(Stream.value(Left(failure))); consumeState(Stream.value(Left(failure)));
}, },
), ),
onError: (error) { onError: (error) {
logError('ComposerController::getAutoCompleteSuggestion:onError: $error'); logWarning('ComposerController::getAutoCompleteSuggestion:onError: $error');
consumeState(Stream.value(Left(error))); consumeState(Stream.value(Left(error)));
}, },
); );
@@ -1133,12 +1133,12 @@ class ComposerController extends BaseController
resultState: value, resultState: value,
queryString: queryString, queryString: queryString,
onFailureCallback: (failure) { onFailureCallback: (failure) {
logError('ComposerController::getAutoCompleteSuggestion:onFailureCallback: $failure'); logWarning('ComposerController::getAutoCompleteSuggestion:onFailureCallback: $failure');
consumeState(Stream.value(Left(failure))); consumeState(Stream.value(Left(failure)));
}, },
), ),
onError: (error) { onError: (error) {
logError('ComposerController::getAutoCompleteSuggestion:onError: $error'); logWarning('ComposerController::getAutoCompleteSuggestion:onError: $error');
consumeState(Stream.value(Left(error))); consumeState(Stream.value(Left(error)));
}, },
) ?? <EmailAddress>[]; ) ?? <EmailAddress>[];
@@ -1205,11 +1205,11 @@ class ComposerController extends BaseController
uploadUri: uploadUri, uploadUri: uploadUri,
); );
} catch (e) { } catch (e) {
logError('ComposerController::uploadAttachmentsAction: $e'); logWarning('ComposerController::uploadAttachmentsAction: $e');
uploadController.consumeState(Stream.value(Left(UploadAttachmentFailure(e, pickedFiles[0])))); uploadController.consumeState(Stream.value(Left(UploadAttachmentFailure(e, pickedFiles[0]))));
} }
} else { } else {
logError('ComposerController::uploadAttachmentsAction: SESSION OR ACCOUNT_ID is NULL'); logWarning('ComposerController::uploadAttachmentsAction: SESSION OR ACCOUNT_ID is NULL');
} }
} }
@@ -1690,7 +1690,7 @@ class ComposerController extends BaseController
try { try {
baseDownloadUrl = mailboxDashBoardController.sessionCurrent?.getDownloadUrl(jmapUrl: dynamicUrlInterceptors.jmapUrl); baseDownloadUrl = mailboxDashBoardController.sessionCurrent?.getDownloadUrl(jmapUrl: dynamicUrlInterceptors.jmapUrl);
} catch (e) { } catch (e) {
logError('ComposerController::_handleUploadInlineSuccess(): $e'); logWarning('ComposerController::_handleUploadInlineSuccess(): $e');
} }
final accountId = mailboxDashBoardController.accountId.value; final accountId = mailboxDashBoardController.accountId.value;
@@ -2350,7 +2350,7 @@ class ComposerController extends BaseController
String? base64, String? base64,
required UploadError uploadError required UploadError uploadError
}) { }) {
logError('ComposerController::handleOnPasteImageFailureAction: $uploadError'); logWarning('ComposerController::handleOnPasteImageFailureAction: $uploadError');
if (!context.mounted) return; if (!context.mounted) return;
appToast.showToastErrorMessage( appToast.showToastErrorMessage(
@@ -44,10 +44,10 @@ class RichTextMobileTabletController extends GetxController {
maxWidth: maxWidth maxWidth: maxWidth
); );
} else { } else {
logError('RichTextMobileTabletController::insertImageData: path is null'); logWarning('RichTextMobileTabletController::insertImageData: path is null');
} }
} catch (e) { } catch (e) {
logError('RichTextMobileTabletController::insertImageData:Exception: $e'); logWarning('RichTextMobileTabletController::insertImageData:Exception: $e');
} }
} }
@@ -300,7 +300,7 @@ class RichTextWebController extends GetxController {
'<img src="${HtmlUtils.convertBase64ToImageResourceData(base64Data: base64Data, mimeType: mimeType)}" data-filename="${platformFile.name}" alt="Image in my signature" style="max-width:${maxWidth != null ? '${maxWidth}px' : '100%'};" data-mimetype="$mimeType"/>' '<img src="${HtmlUtils.convertBase64ToImageResourceData(base64Data: base64Data, mimeType: mimeType)}" data-filename="${platformFile.name}" alt="Image in my signature" style="max-width:${maxWidth != null ? '${maxWidth}px' : '100%'};" data-mimetype="$mimeType"/>'
); );
} else { } else {
logError("RichTextWebController::insertImageAsBase64: bytes is null"); logWarning("RichTextWebController::insertImageAsBase64: bytes is null");
} }
} }
@@ -23,7 +23,7 @@ extension AttachmentDetectionExtension on ComposerController {
return keywords; return keywords;
} }
} catch (e) { } catch (e) {
logError('$runtimeType::validateAttachmentReminder:Error $e'); logWarning('$runtimeType::validateAttachmentReminder:Error $e');
return []; return [];
} }
} }
@@ -1,6 +1,5 @@
import 'package:core/utils/app_logger.dart';
import 'package:html/parser.dart'; import 'package:html/parser.dart';
import 'package:rich_text_composer/views/commons/logger.dart';
import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart';
extension SanitizeSignatureInEmailContentExtension on ComposerController { extension SanitizeSignatureInEmailContentExtension on ComposerController {
@@ -19,7 +18,7 @@ extension SanitizeSignatureInEmailContentExtension on ComposerController {
restoringSignatureButton = true; restoringSignatureButton = true;
await applySignature(signature.innerHtml); await applySignature(signature.innerHtml);
} catch (e) { } catch (e) {
logError('SanitizeSignatureInEmailContentExtension::restoreCollapsibleSignatureButton:Exception = $e'); logWarning('SanitizeSignatureInEmailContentExtension::restoreCollapsibleSignatureButton:Exception = $e');
} }
} }
@@ -33,7 +32,7 @@ extension SanitizeSignatureInEmailContentExtension on ComposerController {
synchronizeInitDraftHash = true; synchronizeInitDraftHash = true;
initEmailDraftHash(); initEmailDraftHash();
} catch (e) { } catch (e) {
logError('SanitizeSignatureInEmailContentExtension::synchronizeInitEmailDraftHash:Exception = $e'); logWarning('SanitizeSignatureInEmailContentExtension::synchronizeInitEmailDraftHash:Exception = $e');
} }
} }
} }
@@ -81,7 +81,7 @@ class _SavingMessageDialogViewState extends State<SavingMessageDialogView> {
} }
void _handleErrorStream(Object error, StackTrace stackTrace) { void _handleErrorStream(Object error, StackTrace stackTrace) {
logError('_SavingMessageDialogViewState::_handleErrorStream: Exception = $error'); logWarning('_SavingMessageDialogViewState::_handleErrorStream: Exception = $error');
if (error is UnknownError && error.message is List<SavingEmailToDraftsCanceledException>) { if (error is UnknownError && error.message is List<SavingEmailToDraftsCanceledException>) {
popBack(result: SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException())); popBack(result: SaveEmailAsDraftsFailure(SavingEmailToDraftsCanceledException()));
} else { } else {
@@ -77,7 +77,7 @@ class _SavingTemplateDialogViewState extends State<SavingTemplateDialogView> {
} }
void _handleErrorStream(Object error, StackTrace stackTrace) { void _handleErrorStream(Object error, StackTrace stackTrace) {
logError('SavingTemplateDialogView::_handleErrorStream: Exception = $error'); logWarning('SavingTemplateDialogView::_handleErrorStream: Exception = $error');
popBack(result: SaveTemplateEmailFailure(exception: error)); popBack(result: SaveTemplateEmailFailure(exception: error));
} }
@@ -78,7 +78,7 @@ class _SendingMessageDialogViewState extends State<SendingMessageDialogView> {
} }
void _handleErrorStream(Object error, StackTrace stackTrace) { void _handleErrorStream(Object error, StackTrace stackTrace) {
logError('_SendingMessageDialogViewState::_handleErrorStream: Exception = $error'); logWarning('_SendingMessageDialogViewState::_handleErrorStream: Exception = $error');
if (error is UnknownError && error.message is List<SendingEmailCanceledException>) { if (error is UnknownError && error.message is List<SendingEmailCanceledException>) {
popBack(result: SendEmailFailure(exception: SendingEmailCanceledException())); popBack(result: SendEmailFailure(exception: SendingEmailCanceledException()));
} else { } else {
@@ -63,7 +63,7 @@ class _PrintDraftDialogViewState extends State<PrintDraftDialogView> {
} }
void _handleErrorStream(Object error, StackTrace stackTrace) { void _handleErrorStream(Object error, StackTrace stackTrace) {
logError('_PrintDraftDialogViewState::_handleErrorStream: Exception = $error'); logWarning('_PrintDraftDialogViewState::_handleErrorStream: Exception = $error');
popBack(result: PrintEmailFailure(exception: error)); popBack(result: PrintEmailFailure(exception: error));
} }
@@ -318,13 +318,13 @@ class _WebEditorState extends State<WebEditorWidget> with TextSelectionMixin {
_signatureTooltipReady = true; _signatureTooltipReady = true;
_signatureTooltipEntry?.markNeedsBuild(); _signatureTooltipEntry?.markNeedsBuild();
} catch (e) { } catch (e) {
logError( logWarning(
'_WebEditorState::_showTooltipAtPosition:addPostFrameCallback:Exception = $e', '_WebEditorState::_showTooltipAtPosition:addPostFrameCallback:Exception = $e',
); );
} }
}); });
} catch (e) { } catch (e) {
logError('_WebEditorState::_showTooltipAtPosition:Exception = $e'); logWarning('_WebEditorState::_showTooltipAtPosition:Exception = $e');
} }
} }
@@ -77,7 +77,7 @@ class DownloadAllAttachmentsForWebInteractor {
yield Right(DownloadAllAttachmentsForWebSuccess(taskId: taskId)); yield Right(DownloadAllAttachmentsForWebSuccess(taskId: taskId));
} catch (e) { } catch (e) {
logError('DownloadAllAttachmentsForWebInteractor::execute():EXCEPTION: $e'); logWarning('DownloadAllAttachmentsForWebInteractor::execute():EXCEPTION: $e');
yield Left(DownloadAllAttachmentsForWebFailure( yield Left(DownloadAllAttachmentsForWebFailure(
exception: e, exception: e,
taskId: taskId, taskId: taskId,
@@ -87,7 +87,7 @@ class DownloadAndGetHtmlContentFromAttachmentInteractor {
)); ));
} }
} catch (e) { } catch (e) {
logError('GetHtmlContentFromAttachmentInteractor:exception: $e'); logWarning('GetHtmlContentFromAttachmentInteractor:exception: $e');
yield Left(DownloadAndGetHtmlContentFromAttachmentFailure( yield Left(DownloadAndGetHtmlContentFromAttachmentFailure(
exception: e, exception: e,
blobId: attachment.blobId, blobId: attachment.blobId,
@@ -61,7 +61,7 @@ class ExportAllAttachmentsInteractor {
yield Right(ExportAllAttachmentsSuccess(result)); yield Right(ExportAllAttachmentsSuccess(result));
} catch (e) { } catch (e) {
logError('ExportAllAttachmentsInteractor::execute():EXCEPTION: $e'); logWarning('ExportAllAttachmentsInteractor::execute():EXCEPTION: $e');
yield Left(ExportAllAttachmentsFailure(exception: e)); yield Left(ExportAllAttachmentsFailure(exception: e));
} }
} }
@@ -499,7 +499,7 @@ class EmailDataSourceImpl extends EmailDataSource {
return listEmailContent.asHtmlString; return listEmailContent.asHtmlString;
} catch (e) { } catch (e) {
logError('EmailDataSourceImpl::_transformEmailContent:Exception = $e'); logWarning('EmailDataSourceImpl::_transformEmailContent:Exception = $e');
return ''; return '';
} }
} }
@@ -87,7 +87,7 @@ class PrintFileDataSourceImpl extends PrintFileDataSource {
return htmlContentTransformed; return htmlContentTransformed;
} catch (e) { } catch (e) {
logError('PrintFileDataSourceImpl::_transformHtmlEmailContent: Exception: $e'); logWarning('PrintFileDataSourceImpl::_transformHtmlEmailContent: Exception: $e');
return ''; return '';
} }
} }
@@ -104,7 +104,7 @@ class HtmlAnalyzer {
return listEventAction; return listEventAction;
} }
} catch(e) { } catch(e) {
logError('HtmlAnalyzer::getListEventAction:Exception: $e'); logWarning('HtmlAnalyzer::getListEventAction:Exception: $e');
return []; return [];
} }
} }
@@ -205,7 +205,7 @@ class HtmlAnalyzer {
})); }));
return document.body?.innerHtml ?? emailContent; return document.body?.innerHtml ?? emailContent;
} catch (e) { } catch (e) {
logError('HtmlAnalyzer::removeCollapsedExpandedSignatureEffect:Exception = $e'); logWarning('HtmlAnalyzer::removeCollapsedExpandedSignatureEffect:Exception = $e');
return emailContent; return emailContent;
} }
} }
@@ -233,7 +233,7 @@ class HtmlAnalyzer {
log('HtmlAnalyzer::_retrieveAttachmentFromUpload:Attachment = $attachment | taskId = $taskId'); log('HtmlAnalyzer::_retrieveAttachmentFromUpload:Attachment = $attachment | taskId = $taskId');
return (attachment, taskId); return (attachment, taskId);
} catch (e) { } catch (e) {
logError('HtmlAnalyzer::_retrieveAttachmentFromUpload:Exception = $e'); logWarning('HtmlAnalyzer::_retrieveAttachmentFromUpload:Exception = $e');
return null; return null;
} }
} }
@@ -259,7 +259,7 @@ class HtmlAnalyzer {
})); }));
return document.body?.innerHtml ?? emailContent; return document.body?.innerHtml ?? emailContent;
} catch (e) { } catch (e) {
logError('HtmlAnalyzer::removeStyleLazyLoadDisplayInlineImages:Exception = $e'); logWarning('HtmlAnalyzer::removeStyleLazyLoadDisplayInlineImages:Exception = $e');
return emailContent; return emailContent;
} }
} }
@@ -93,7 +93,7 @@ class CalendarEventAPI {
methodCallId, methodCallId,
GetCalendarEventAttendanceResponse.deserialize); GetCalendarEventAttendanceResponse.deserialize);
} catch (e) { } catch (e) {
logError('CalendarEventAPI.parse free/busy query error: $e'); logWarning('CalendarEventAPI.parse free/busy query error: $e');
return null; return null;
} }
} }
@@ -668,7 +668,7 @@ class EmailAPI with HandleSetErrorMixin, MailAPIMixin {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('EmailAPI::updateEmailDrafts: Exception = $e'); logWarning('EmailAPI::updateEmailDrafts: Exception = $e');
} }
return emailCreated; return emailCreated;
@@ -713,7 +713,7 @@ class EmailAPI with HandleSetErrorMixin, MailAPIMixin {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('EmailAPI::updateEmailTemplate: Exception = $e'); logWarning('EmailAPI::updateEmailTemplate: Exception = $e');
} }
return emailCreated; return emailCreated;
@@ -84,7 +84,7 @@ class EmailRepositoryImpl extends EmailRepository {
[emailRequest.emailIdAnsweredOrForwarded!], [emailRequest.emailIdAnsweredOrForwarded!],
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::sendEmail::markAsAnswered:Exception $e'); logWarning('EmailRepositoryImpl::sendEmail::markAsAnswered:Exception $e');
} }
} else if (emailRequest.isEmailForwarded) { } else if (emailRequest.isEmailForwarded) {
try { try {
@@ -94,7 +94,7 @@ class EmailRepositoryImpl extends EmailRepository {
[emailRequest.emailIdAnsweredOrForwarded!], [emailRequest.emailIdAnsweredOrForwarded!],
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::sendEmail::markAsForwarded:Exception $e'); logWarning('EmailRepositoryImpl::sendEmail::markAsForwarded:Exception $e');
} }
} }
@@ -126,7 +126,7 @@ class EmailRepositoryImpl extends EmailRepository {
readActions, readActions,
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::markAsRead:exception $e'); logWarning('EmailRepositoryImpl::markAsRead:exception $e');
} }
return result; return result;
@@ -168,7 +168,7 @@ class EmailRepositoryImpl extends EmailRepository {
), ),
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::moveToMailbox:exception $e'); logWarning('EmailRepositoryImpl::moveToMailbox:exception $e');
} }
return result; return result;
@@ -198,7 +198,7 @@ class EmailRepositoryImpl extends EmailRepository {
markStarAction markStarAction
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::markAsStar:exception $e'); logWarning('EmailRepositoryImpl::markAsStar:exception $e');
} }
return result; return result;
} }
@@ -241,7 +241,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::saveEmailAsDrafts:exception $e'); logWarning('EmailRepositoryImpl::saveEmailAsDrafts:exception $e');
} }
return result; return result;
} }
@@ -267,7 +267,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::removeEmailDrafts:exception $e'); logWarning('EmailRepositoryImpl::removeEmailDrafts:exception $e');
} }
return result; return result;
} }
@@ -295,7 +295,7 @@ class EmailRepositoryImpl extends EmailRepository {
oldEmailId, oldEmailId,
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::updateEmailDrafts:exception $e'); logWarning('EmailRepositoryImpl::updateEmailDrafts:exception $e');
} }
return result; return result;
} }
@@ -326,7 +326,7 @@ class EmailRepositoryImpl extends EmailRepository {
cancelToken: cancelToken cancelToken: cancelToken
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::saveEmailAsTemplate:exception $e'); logWarning('EmailRepositoryImpl::saveEmailAsTemplate:exception $e');
} }
return result; return result;
} }
@@ -354,7 +354,7 @@ class EmailRepositoryImpl extends EmailRepository {
oldEmailId, oldEmailId,
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::updateEmailTemplate:exception $e'); logWarning('EmailRepositoryImpl::updateEmailTemplate:exception $e');
} }
return result; return result;
} }
@@ -378,7 +378,7 @@ class EmailRepositoryImpl extends EmailRepository {
await emailDataSource[DataSourceType.hiveCache] await emailDataSource[DataSourceType.hiveCache]
!.deleteMultipleEmailsPermanently(session, accountId, result.emailIdsSuccess); !.deleteMultipleEmailsPermanently(session, accountId, result.emailIdsSuccess);
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::deleteMultipleEmailsPermanently:exception $e'); logWarning('EmailRepositoryImpl::deleteMultipleEmailsPermanently:exception $e');
} }
return result; return result;
@@ -404,7 +404,7 @@ class EmailRepositoryImpl extends EmailRepository {
emailId, emailId,
); );
} catch (e) { } catch (e) {
logError('EmailRepositoryImpl::deleteEmailPermanently:exception $e'); logWarning('EmailRepositoryImpl::deleteEmailPermanently:exception $e');
} }
return result; return result;
@@ -106,7 +106,7 @@ class GetEmailContentInteractor {
)); ));
} }
} catch (e) { } catch (e) {
logError('GetEmailContentInteractor::_getContentEmailFromServer():EXCEPTION: $e'); logWarning('GetEmailContentInteractor::_getContentEmailFromServer():EXCEPTION: $e');
yield Left<Failure, Success>(GetEmailContentFailure( yield Left<Failure, Success>(GetEmailContentFailure(
e, e,
onRetry: execute( onRetry: execute(
@@ -149,7 +149,7 @@ class GetEmailContentInteractor {
) )
)); ));
} catch (e) { } catch (e) {
logError('GetEmailContentInteractor::_getStoredOpenedEmail():EXCEPTION: $e'); logWarning('GetEmailContentInteractor::_getStoredOpenedEmail():EXCEPTION: $e');
yield* _getStoredNewEmail( yield* _getStoredNewEmail(
session, session,
accountId, accountId,
@@ -190,7 +190,7 @@ class GetEmailContentInteractor {
) )
)); ));
} catch (e) { } catch (e) {
logError('GetEmailContentInteractor::_getStoredNewEmail():EXCEPTION: $e'); logWarning('GetEmailContentInteractor::_getStoredNewEmail():EXCEPTION: $e');
yield* _getContentEmailFromServer( yield* _getContentEmailFromServer(
session, session,
accountId, accountId,
@@ -59,7 +59,7 @@ class SaveTemplateEmailInteractor {
yield Right(SaveTemplateEmailSuccess(emailTemplateSaved.id!)); yield Right(SaveTemplateEmailSuccess(emailTemplateSaved.id!));
} }
} catch (e) { } catch (e) {
logError('SaveTemplateEmailInteractor::execute(): $e'); logWarning('SaveTemplateEmailInteractor::execute(): $e');
if (createEmailRequest.templateEmailId != null) { if (createEmailRequest.templateEmailId != null) {
yield Left(UpdateTemplateEmailFailure(exception: e)); yield Left(UpdateTemplateEmailFailure(exception: e));
} else { } else {
@@ -76,7 +76,7 @@ class SaveTemplateEmailInteractor {
isTemplate: true); isTemplate: true);
return emailCreated; return emailCreated;
} catch (e) { } catch (e) {
logError('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e'); logWarning('CreateNewAndSaveEmailToDraftsInteractor::_createEmailObject: Exception: $e');
return null; return null;
} }
} }
@@ -41,7 +41,7 @@ class StoreListNewEmailInteractor {
await _emailRepository.getStoredNewEmail(session, accountId, detailedEmail.emailId); await _emailRepository.getStoredNewEmail(session, accountId, detailedEmail.emailId);
return true; return true;
} catch (err) { } catch (err) {
logError('StoreNewEmailInteractor::_isNewEmailAlreadyStored():EXCEPTION: $err'); logWarning('StoreNewEmailInteractor::_isNewEmailAlreadyStored():EXCEPTION: $err');
return false; return false;
} }
} }
@@ -39,7 +39,7 @@ class StoreOpenedEmailInteractor {
await _emailRepository.getStoredOpenedEmail(session, accountId, detailedEmail.emailId); await _emailRepository.getStoredOpenedEmail(session, accountId, detailedEmail.emailId);
return true; return true;
} catch (err) { } catch (err) {
logError('StoreOpenedEmailInteractor::isOpenedEmailAlreadyStored():EXCEPTION: $err'); logWarning('StoreOpenedEmailInteractor::isOpenedEmailAlreadyStored():EXCEPTION: $err');
return false; return false;
} }
} }
@@ -482,7 +482,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
transformConfiguration transformConfiguration
)); ));
} catch (e) { } catch (e) {
logError('SingleEmailController::_getEmailContentAction(): $e'); logWarning('SingleEmailController::_getEmailContentAction(): $e');
consumeState(Stream.value(Left(GetEmailContentFailure( consumeState(Stream.value(Left(GetEmailContentFailure(
e, e,
onRetry: e is UnknownUriException onRetry: e is UnknownUriException
@@ -15,7 +15,7 @@ extension HandleOpenAttachmentListExtension on SingleEmailController {
}) { }) {
final scrollController = threadDetailController?.scrollController; final scrollController = threadDetailController?.scrollController;
if (scrollController == null || !scrollController.hasClients) { if (scrollController == null || !scrollController.hasClients) {
logError( logWarning(
'$runtimeType::jumpToAttachmentList(): scrollController is null'); '$runtimeType::jumpToAttachmentList(): scrollController is null');
return; return;
} }
@@ -106,7 +106,7 @@ class EmailUtils {
MailAddress mailAddress = MailAddress.validateAddress(address); MailAddress mailAddress = MailAddress.validateAddress(address);
return GetUtils.isEmail(mailAddress.stripDetails().asString()) && mailAddress.asString().isNotEmpty; return GetUtils.isEmail(mailAddress.stripDetails().asString()) && mailAddress.asString().isNotEmpty;
} catch(e) { } catch(e) {
logError('EmailUtils::isEmailAddressValid: Exception = $e'); logWarning('EmailUtils::isEmailAddressValid: Exception = $e');
return false; return false;
} }
} }
@@ -137,7 +137,7 @@ class EmailUtils {
return matches.map((match) => match.group(1)!).toList(); return matches.map((match) => match.group(1)!).toList();
} catch (e) { } catch (e) {
logError('EmailUtils::extractMailtoLinksFromListPost:Exception = $e'); logWarning('EmailUtils::extractMailtoLinksFromListPost:Exception = $e');
return []; return [];
} }
} }
@@ -174,7 +174,7 @@ class EmailUtils {
bccMailAddresses: bccMailAddresses bccMailAddresses: bccMailAddresses
); );
} catch (e) { } catch (e) {
logError('EmailUtils::extractRecipientsFromListMailtoLink:Exception = $e'); logWarning('EmailUtils::extractRecipientsFromListMailtoLink:Exception = $e');
return ( return (
toMailAddresses: [], toMailAddresses: [],
ccMailAddresses: [], ccMailAddresses: [],
@@ -207,7 +207,7 @@ class EmailUtils {
bccMailAddresses: navigationRouter.bcc ?? [], bccMailAddresses: navigationRouter.bcc ?? [],
); );
} catch (e) { } catch (e) {
logError('EmailUtils::extractRecipientsFromMailtoLink:Exception = $e'); logWarning('EmailUtils::extractRecipientsFromMailtoLink:Exception = $e');
return ( return (
toMailAddresses: [], toMailAddresses: [],
ccMailAddresses: [], ccMailAddresses: [],
@@ -240,7 +240,7 @@ class EmailUtils {
type: type?.isNotEmpty == true ? MediaType.parse(type!) : null, type: type?.isNotEmpty == true ? MediaType.parse(type!) : null,
); );
} catch (e) { } catch (e) {
logError('EmailUtils::parsingAttachmentByUri:Exception = $e:'); logWarning('EmailUtils::parsingAttachmentByUri:Exception = $e:');
return null; return null;
} }
} }
@@ -329,7 +329,7 @@ class EmailUtils {
MailAddress mailAddress = MailAddress.validateAddress(emailAddress); MailAddress mailAddress = MailAddress.validateAddress(emailAddress);
return mailAddress.domain.asString(); return mailAddress.domain.asString();
} catch (e) { } catch (e) {
logError('EmailUtils::getDomainByEmailAddress:Exception is $e'); logWarning('EmailUtils::getDomainByEmailAddress:Exception is $e');
return ''; return '';
} }
} }
@@ -161,7 +161,7 @@ class _PDFViewerState extends State<PDFViewer> {
previewerOptions: PreviewerOptions( previewerOptions: PreviewerOptions(
previewerState: previewerState, previewerState: previewerState,
onError: (error) { onError: (error) {
logError('_PDFViewerState::build:openData:onError:: $error'); logWarning('_PDFViewerState::build:openData:onError:: $error');
_pdfViewStateNotifier.value = DownloadAttachmentForWebFailure(exception: error); _pdfViewStateNotifier.value = DownloadAttachmentForWebFailure(exception: error);
}, },
errorMessage: AppLocalizations.of(context).noPreviewAvailable, errorMessage: AppLocalizations.of(context).noPreviewAvailable,
@@ -294,7 +294,7 @@ class EmailPreviewerController extends ReloadableController {
), ),
)); ));
} catch (e) { } catch (e) {
logError('EmailPreviewerController::_handleParseEmailByBlobIdSuccess(): $e'); logWarning('EmailPreviewerController::_handleParseEmailByBlobIdSuccess(): $e');
consumeState(Stream.value(Left(PreviewEmailFromEmlFileFailure(e)))); consumeState(Stream.value(Left(PreviewEmailFromEmlFileFailure(e))));
} }
} }
@@ -336,7 +336,7 @@ class EmailPreviewerController extends ReloadableController {
onReceiveController: _downloadAttachmentStreamController!) onReceiveController: _downloadAttachmentStreamController!)
.listen(_handleDownloadAttachmentViewState); .listen(_handleDownloadAttachmentViewState);
} catch (e) { } catch (e) {
logError('EmailPreviewerController::_handleParseEmailByBlobIdSuccess(): $e'); logWarning('EmailPreviewerController::_handleParseEmailByBlobIdSuccess(): $e');
consumeState(Stream.value(Left(DownloadAttachmentForWebFailure( consumeState(Stream.value(Left(DownloadAttachmentForWebFailure(
attachment: attachment, attachment: attachment,
taskId: attachment.downloadTaskId, taskId: attachment.downloadTaskId,
@@ -74,7 +74,7 @@ extension SessionExtensions on Session {
try { try {
return getOwnEmailAddressOrEmpty().split('@').last; return getOwnEmailAddressOrEmpty().split('@').last;
} catch (e) { } catch (e) {
logError('SessionExtensions::internalDomain: Exception: $e'); logWarning('SessionExtensions::internalDomain: Exception: $e');
return ''; return '';
} }
} }
@@ -88,7 +88,7 @@ extension SessionExtensions on Session {
log('SessionExtensions::getMinInputLengthAutocomplete:minInputLength = $minInputLength'); log('SessionExtensions::getMinInputLengthAutocomplete:minInputLength = $minInputLength');
return minInputLength; return minInputLength;
} catch (e) { } catch (e) {
logError('SessionExtensions::getMinInputLengthAutocomplete():[Exception] $e'); logWarning('SessionExtensions::getMinInputLengthAutocomplete():[Exception] $e');
return null; return null;
} }
} }
@@ -102,7 +102,7 @@ extension SessionExtensions on Session {
log('SessionExtensions::getContactSupportCapability:contactSupportCapability = $contactSupportCapability'); log('SessionExtensions::getContactSupportCapability:contactSupportCapability = $contactSupportCapability');
return contactSupportCapability; return contactSupportCapability;
} catch (e) { } catch (e) {
logError('SessionExtensions::getContactSupportCapability():[Exception] $e'); logWarning('SessionExtensions::getContactSupportCapability():[Exception] $e');
return null; return null;
} }
} }
@@ -142,7 +142,7 @@ extension SessionExtensions on Session {
final props = capability?.props[0] as Map<String, dynamic>?; final props = capability?.props[0] as Map<String, dynamic>?;
return props?[subaddressingSupported] ?? false; return props?[subaddressingSupported] ?? false;
} catch (e) { } catch (e) {
logError('SessionExtensions::isSubAddressingSupported:Exception = $e'); logWarning('SessionExtensions::isSubAddressingSupported:Exception = $e');
return false; return false;
} }
} }
@@ -164,7 +164,7 @@ extension SessionExtensions on Session {
log('SessionExtensions::getSaaSAccountCapability:saaSAccountCapability = $saaSAccountCapability'); log('SessionExtensions::getSaaSAccountCapability:saaSAccountCapability = $saaSAccountCapability');
return saaSAccountCapability; return saaSAccountCapability;
} catch (e) { } catch (e) {
logError('SessionExtensions::getSaaSAccountCapability():[Exception] $e'); logWarning('SessionExtensions::getSaaSAccountCapability():[Exception] $e');
return null; return null;
} }
} }
@@ -202,7 +202,7 @@ class HomeController extends ReloadableController {
), ),
); );
} catch (e) { } catch (e) {
logError('HomeController::_getSessionActionToLogOut:Exception = $e'); logWarning('HomeController::_getSessionActionToLogOut:Exception = $e');
_handleGetSessionFailureToLogOut(authenticationViewStateSuccess); _handleGetSessionFailureToLogOut(authenticationViewStateSuccess);
} }
} }
@@ -24,7 +24,7 @@ class GetIdentityCacheOnWebInteractor {
yield Right(GetIdentityCacheOnWebSuccess(result)); yield Right(GetIdentityCacheOnWebSuccess(result));
} catch (exception) { } catch (exception) {
logError("$runtimeType::execute: $exception"); logWarning("$runtimeType::execute: $exception");
yield Left(GetIdentityCacheOnWebFailure(exception: exception)); yield Left(GetIdentityCacheOnWebFailure(exception: exception));
} }
} }
@@ -17,7 +17,7 @@ class RemoveIdentityCacheOnWebInteractor {
yield Right(RemoveIdentityCacheOnWebSuccess()); yield Right(RemoveIdentityCacheOnWebSuccess());
} catch (exception) { } catch (exception) {
logError("$runtimeType::execute: $exception"); logWarning("$runtimeType::execute: $exception");
yield Left(RemoveIdentityCacheOnWebFailure(exception: exception)); yield Left(RemoveIdentityCacheOnWebFailure(exception: exception));
} }
} }
@@ -26,7 +26,7 @@ class SaveIdentityCacheOnWebInteractor {
identityCache: identityCache); identityCache: identityCache);
yield Right(SaveIdentityCacheOnWebSuccess()); yield Right(SaveIdentityCacheOnWebSuccess());
} catch (exception) { } catch (exception) {
logError("$runtimeType::execute: $exception"); logWarning("$runtimeType::execute: $exception");
yield Left(SaveIdentityCacheOnWebFailure(exception: exception)); yield Left(SaveIdentityCacheOnWebFailure(exception: exception));
} }
} }
@@ -701,7 +701,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
); );
} }
} else { } else {
logError("IdentityCreatorController::pickImage: context is unmounted"); logWarning("IdentityCreatorController::pickImage: context is unmounted");
} }
} }
@@ -732,7 +732,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
) )
); );
} else { } else {
logError("IdentityCreatorController::_insertInlineImage: context is unmounted"); logWarning("IdentityCreatorController::_insertInlineImage: context is unmounted");
} }
} else if (publicAssetController != null) { } else if (publicAssetController != null) {
publicAssetController!.uploadFileToBlob(file); publicAssetController!.uploadFileToBlob(file);
@@ -747,7 +747,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
pathContains: IdentityCreatorConstants.prefixCompressedInlineImageTemp); pathContains: IdentityCreatorConstants.prefixCompressedInlineImageTemp);
} }
} else { } else {
logError("IdentityCreatorController::_insertInlineImage: Platform not supported"); logWarning("IdentityCreatorController::_insertInlineImage: Platform not supported");
} }
} }
} }
@@ -765,7 +765,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
isCompressingInlineImage.value = false; isCompressingInlineImage.value = false;
return compressedFile; return compressedFile;
} catch (e) { } catch (e) {
logError("$runtimeType::_compressFileAction: compress image error: $e"); logWarning("$runtimeType::_compressFileAction: compress image error: $e");
isCompressingInlineImage.value = false; isCompressingInlineImage.value = false;
if (context.mounted) { if (context.mounted) {
appToast.showToastErrorMessage( appToast.showToastErrorMessage(
@@ -888,7 +888,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
{String? base64, {String? base64,
required UploadError uploadError} required UploadError uploadError}
) { ) {
logError('$runtimeType::onPasteImageFailure: $uploadError'); logWarning('$runtimeType::onPasteImageFailure: $uploadError');
appToast.showToastErrorMessage( appToast.showToastErrorMessage(
context, context,
AppLocalizations.of(context).thisImageCannotBePastedIntoTheEditor); AppLocalizations.of(context).thisImageCannotBePastedIntoTheEditor);
@@ -941,7 +941,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
) )
); );
} else { } else {
logError("IdentityCreatorController::_uploadMultipleFilesToPublicAsset: context is unmounted"); logWarning("IdentityCreatorController::_uploadMultipleFilesToPublicAsset: context is unmounted");
} }
return; return;
} }
@@ -959,7 +959,7 @@ class IdentityCreatorController extends BaseController with DragDropFileMixin im
} }
); );
} catch (e) { } catch (e) {
logError("IdentityCreatorController::_uploadMultipleFilesToPublicAsset: error: $e"); logWarning("IdentityCreatorController::_uploadMultipleFilesToPublicAsset: error: $e");
} }
} }
@@ -61,7 +61,7 @@ class AccountCacheManager extends CacheManagerInteraction {
await _accountCacheClient.insertMultipleItem(legacyMapItems); await _accountCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_accountCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_accountCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_accountCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_accountCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -38,7 +38,7 @@ class AuthenticationInfoCacheManager extends CacheManagerInteraction {
await _authenticationInfoCacheClient.insertMultipleItem(legacyMapItems); await _authenticationInfoCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_authenticationInfoCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_authenticationInfoCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_authenticationInfoCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_authenticationInfoCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -28,7 +28,7 @@ class EncryptionKeyCacheManager extends CacheManagerInteraction {
await _encryptionKeyCacheClient.insertMultipleItem(legacyMapItems); await _encryptionKeyCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_encryptionKeyCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_encryptionKeyCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_encryptionKeyCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_encryptionKeyCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -63,7 +63,7 @@ class OidcConfigurationCacheManager extends CacheManagerInteraction {
await _oidcConfigurationCacheClient.insertMultipleItem(legacyMapItems); await _oidcConfigurationCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_oidcConfigurationCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_oidcConfigurationCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_oidcConfigurationCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_oidcConfigurationCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -46,7 +46,7 @@ class TokenOidcCacheManager extends CacheManagerInteraction {
await _tokenOidcCacheClient.insertMultipleItem(legacyMapItems); await _tokenOidcCacheClient.insertMultipleItem(legacyMapItems);
log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_tokenOidcCacheClient.tableName}" → IsolatedHive DONE'); log('$runtimeType::migrateHiveToIsolatedHive(): ✅ Migrate Hive box "${_tokenOidcCacheClient.tableName}" → IsolatedHive DONE');
} catch (e) { } catch (e) {
logError('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_tokenOidcCacheClient.tableName}" → IsolatedHive FAILED, Error: $e'); logWarning('$runtimeType::migrateHiveToIsolatedHive(): ❌ Migrate Hive box "${_tokenOidcCacheClient.tableName}" → IsolatedHive FAILED, Error: $e');
} }
} }
} }
@@ -74,7 +74,7 @@ mixin AuthenticationClientInteractionMixin {
dynamic handleException(dynamic exception) { dynamic handleException(dynamic exception) {
if (exception is FlutterAppAuthPlatformException) { if (exception is FlutterAppAuthPlatformException) {
logError('$runtimeType::handleException: ErrorDetails = ${exception.platformErrorDetails.toString()}'); logWarning('$runtimeType::handleException: ErrorDetails = ${exception.platformErrorDetails.toString()}');
final errorCode = exception.platformErrorDetails.error; final errorCode = exception.platformErrorDetails.error;
if (errorCode != null) { if (errorCode != null) {
final oauthErrorCode = OAuthAuthorizationError.fromErrorCode( final oauthErrorCode = OAuthAuthorizationError.fromErrorCode(
@@ -92,7 +92,7 @@ class AuthenticationClientMobile with AuthenticationClientInteractionMixin
throw AccessTokenInvalidException(); throw AccessTokenInvalidException();
} }
} catch (e) { } catch (e) {
logError('$runtimeType::refreshingTokensOIDC(): $e'); logWarning('$runtimeType::refreshingTokensOIDC(): $e');
throw handleException(e); throw handleException(e);
} }
} }
@@ -89,7 +89,7 @@ class AuthenticationClientWeb with AuthenticationClientInteractionMixin
throw AccessTokenInvalidException(); throw AccessTokenInvalidException();
} }
} catch (e) { } catch (e) {
logError('$runtimeType::refreshingTokensOIDC(): $e'); logWarning('$runtimeType::refreshingTokensOIDC(): $e');
throw handleException(e); throw handleException(e);
} }
} }
@@ -70,10 +70,10 @@ class DnsLookupManager {
} }
log('$runtimeType::lookupJmapUrl → ⚠️ No records via ${priority.label}, continuing...'); log('$runtimeType::lookupJmapUrl → ⚠️ No records via ${priority.label}, continuing...');
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
logError( logWarning(
'$runtimeType::lookupJmapUrl → ⏱️ ${priority.label} lookup timed out'); '$runtimeType::lookupJmapUrl → ⏱️ ${priority.label} lookup timed out');
} catch (error, stack) { } catch (error, stack) {
logError( logWarning(
'$runtimeType::lookupJmapUrl → ❌ ${priority.label} lookup failed: $error, $stack'); '$runtimeType::lookupJmapUrl → ❌ ${priority.label} lookup failed: $error, $stack');
} }
} }
@@ -83,7 +83,7 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
@override @override
void onError(DioError err, ErrorInterceptorHandler handler) async { void onError(DioError err, ErrorInterceptorHandler handler) async {
logError('AuthorizationInterceptors::onError(): DIO_ERROR = $err'); logWarning('AuthorizationInterceptors::onError(): DIO_ERROR = $err');
try { try {
final requestOptions = err.requestOptions; final requestOptions = err.requestOptions;
final extraInRequest = requestOptions.extra; final extraInRequest = requestOptions.extra;
@@ -151,8 +151,12 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
} else { } else {
return super.onError(err, handler); return super.onError(err, handler);
} }
} catch (e) { } catch (e, stackTrace) {
logError('AuthorizationInterceptors::onError:Exception: $e'); logError(
'AuthorizationInterceptors::onError:Exception: $e',
exception: e,
stackTrace: stackTrace,
);
if (e is ServerError || e is TemporarilyUnavailable) { if (e is ServerError || e is TemporarilyUnavailable) {
return super.onError( return super.onError(
DioError(requestOptions: err.requestOptions, error: e), DioError(requestOptions: err.requestOptions, error: e),
@@ -166,14 +170,17 @@ class AuthorizationInterceptors extends QueuedInterceptorsWrapper {
Stream<List<int>>? _getDataUploadRequest(dynamic mapUploadExtra) { Stream<List<int>>? _getDataUploadRequest(dynamic mapUploadExtra) {
try { try {
String? filePath = mapUploadExtra[FileUploader.filePathExtraKey]; if (mapUploadExtra is! Map) return null;
final filePath = mapUploadExtra[FileUploader.filePathExtraKey] as String?;
if (filePath?.isNotEmpty == true) { if (filePath?.isNotEmpty == true) {
return File(filePath!).openRead(); return File(filePath!).openRead();
} else { } else {
return mapUploadExtra[FileUploader.streamDataExtraKey]; return mapUploadExtra[FileUploader.streamDataExtraKey] as Stream<List<int>>?;
} }
} catch(e) { } catch(e) {
log('AuthorizationInterceptors::_getDataUploadRequest: Exception = $e'); logWarning(
'AuthorizationInterceptors::_getDataUploadRequest: Exception = $e',
);
return null; return null;
} }
} }
@@ -24,7 +24,7 @@ class AuthenticateOidcOnBrowserInteractor {
config.scopes); config.scopes);
yield Right<Failure, Success>(AuthenticateOidcOnBrowserSuccess()); yield Right<Failure, Success>(AuthenticateOidcOnBrowserSuccess());
} catch (e) { } catch (e) {
logError('AuthenticateOidcOnBrowserInteractor::execute(): $e'); logWarning('AuthenticateOidcOnBrowserInteractor::execute(): $e');
yield Left<Failure, Success>(AuthenticateOidcOnBrowserFailure(e)); yield Left<Failure, Success>(AuthenticateOidcOnBrowserFailure(e));
} }
} }
@@ -28,7 +28,7 @@ class GetOIDCConfigurationInteractor {
GetOIDCConfigurationSuccess(configWithLoginHint), GetOIDCConfigurationSuccess(configWithLoginHint),
); );
} catch (e) { } catch (e) {
logError('$runtimeType::execute():oidcResponse = ${oidcResponse.runtimeType} | Exception = $e'); logWarning('$runtimeType::execute():oidcResponse = ${oidcResponse.runtimeType} | Exception = $e');
if (oidcResponse is BaseUrlOidcResponse) { if (oidcResponse is BaseUrlOidcResponse) {
yield Left<Failure, Success>(GetOIDCConfigurationFromBaseUrlFailure(e)); yield Left<Failure, Success>(GetOIDCConfigurationFromBaseUrlFailure(e));
} else { } else {
@@ -53,14 +53,14 @@ class GetTokenOIDCInteractor {
baseUri, baseUri,
)); ));
} on PlatformException catch (e) { } on PlatformException catch (e) {
logError('GetTokenOIDCInteractor::execute(): PlatformException ${e.message} - ${e.stacktrace}'); logWarning('GetTokenOIDCInteractor::execute(): PlatformException ${e.message} - ${e.stacktrace}');
if (NoSuitableBrowserForOIDCException.verifyException(e)) { if (NoSuitableBrowserForOIDCException.verifyException(e)) {
yield Left<Failure, Success>(GetTokenOIDCFailure(NoSuitableBrowserForOIDCException())); yield Left<Failure, Success>(GetTokenOIDCFailure(NoSuitableBrowserForOIDCException()));
} else { } else {
yield Left<Failure, Success>(GetTokenOIDCFailure(e)); yield Left<Failure, Success>(GetTokenOIDCFailure(e));
} }
} catch (e) { } catch (e) {
logError('GetTokenOIDCInteractor::execute(): $e'); logWarning('GetTokenOIDCInteractor::execute(): $e');
yield Left<Failure, Success>(GetTokenOIDCFailure(e)); yield Left<Failure, Success>(GetTokenOIDCFailure(e));
} }
} }
@@ -43,7 +43,7 @@ class TryGuessingWebFingerInteractor {
yield Right(TryGuessingWebFingerSuccess(firstNonNullResponse)); yield Right(TryGuessingWebFingerSuccess(firstNonNullResponse));
} }
} catch (e) { } catch (e) {
logError('$runtimeType::execute(): Exception = $e'); logWarning('$runtimeType::execute(): Exception = $e');
yield Left(TryGuessingWebFingerFailure(exception: e)); yield Left(TryGuessingWebFingerFailure(exception: e));
} }
} }
@@ -45,7 +45,7 @@ class UpdateAccountCacheInteractor {
try { try {
return session.getQualifiedApiUrl(baseUrl: baseUrl); return session.getQualifiedApiUrl(baseUrl: baseUrl);
} catch (e) { } catch (e) {
logError('UpdateAccountCacheInteractor::_getQualifiedApiUrl:Exception = $e'); logWarning('UpdateAccountCacheInteractor::_getQualifiedApiUrl:Exception = $e');
return ''; return '';
} }
} }
@@ -224,7 +224,7 @@ class LoginController extends ReloadableController {
@override @override
void handleUrgentException({Failure? failure, Exception? exception}) { void handleUrgentException({Failure? failure, Exception? exception}) {
logError('LoginController::handleUrgentException:Exception: $exception | Failure: $failure'); logWarning('LoginController::handleUrgentException:Exception: $exception | Failure: $failure');
if (failure is CheckOIDCIsAvailableFailure) { if (failure is CheckOIDCIsAvailableFailure) {
_handleCheckOIDCIsAvailableFailure(failure); _handleCheckOIDCIsAvailableFailure(failure);
} else if (failure is GetOIDCConfigurationFromBaseUrlFailure) { } else if (failure is GetOIDCConfigurationFromBaseUrlFailure) {
@@ -316,7 +316,7 @@ class LoginController extends ReloadableController {
featureFailure = failure; featureFailure = failure;
tryGetOIDCConfigurationFromBaseUrl(_currentBaseUrl!); tryGetOIDCConfigurationFromBaseUrl(_currentBaseUrl!);
} catch (e) { } catch (e) {
logError('LoginController::_handleCheckOIDCIsAvailableFailure:Exception = $e'); logWarning('LoginController::_handleCheckOIDCIsAvailableFailure:Exception = $e');
handleOIDCIsNotAvailable(failure); handleOIDCIsNotAvailable(failure);
} }
} }
@@ -78,7 +78,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
log('MailboxRepositoryImpl::_getAllMailboxFromCache: MAILBOX_CACHED = ${cacheMailboxResponse.mailboxes.length} | STATE_CACHED = ${cacheMailboxResponse.state?.value}'); log('MailboxRepositoryImpl::_getAllMailboxFromCache: MAILBOX_CACHED = ${cacheMailboxResponse.mailboxes.length} | STATE_CACHED = ${cacheMailboxResponse.state?.value}');
return cacheMailboxResponse; return cacheMailboxResponse;
} catch (e) { } catch (e) {
logError('MailboxRepositoryImpl::_getAllMailboxFromCache: Exception: $e'); logWarning('MailboxRepositoryImpl::_getAllMailboxFromCache: Exception: $e');
return null; return null;
} }
} }
@@ -106,7 +106,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
await _syncNewMailboxesInCache(accountId, userName, newMailboxes); await _syncNewMailboxesInCache(accountId, userName, newMailboxes);
await _syncNewMailboxStateInCache(accountId, userName, newState); await _syncNewMailboxStateInCache(accountId, userName, newState);
} catch (e) { } catch (e) {
logError('MailboxRepositoryImpl::_syncNewInCache: Exception = $e'); logWarning('MailboxRepositoryImpl::_syncNewInCache: Exception = $e');
} }
} }
@@ -220,7 +220,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
await mapDataSource[DataSourceType.local] await mapDataSource[DataSourceType.local]
!.renameMailbox(session, accountId, request); !.renameMailbox(session, accountId, request);
} catch (e) { } catch (e) {
logError('MailboxRepositoryImpl::renameMailbox: Exception: $e'); logWarning('MailboxRepositoryImpl::renameMailbox: Exception: $e');
} }
return result; return result;
@@ -257,7 +257,7 @@ class MailboxRepositoryImpl extends MailboxRepository {
) ?? Future.value(), ) ?? Future.value(),
]); ]);
} catch (e) { } catch (e) {
logError('MailboxRepositoryImpl::markAsMailboxRead: Exception: $e'); logWarning('MailboxRepositoryImpl::markAsMailboxRead: Exception: $e');
} }
return result; return result;
} }
@@ -60,7 +60,7 @@ class CreateDefaultMailboxInteractor {
); );
return mailboxUpdatedRecord.$1; return mailboxUpdatedRecord.$1;
} catch (e) { } catch (e) {
logError('CreateDefaultMailboxInteractor::_updateRoleToListMailbox:Exception = $e'); logWarning('CreateDefaultMailboxInteractor::_updateRoleToListMailbox:Exception = $e');
return mailboxes; return mailboxes;
} }
} }
@@ -49,7 +49,7 @@ class DeleteMultipleMailboxInteractor {
currentMailboxState: currentMailboxState)); currentMailboxState: currentMailboxState));
} }
} catch (e) { } catch (e) {
logError('DeleteMultipleMailboxInteractor::execute(): exception: $e'); logWarning('DeleteMultipleMailboxInteractor::execute(): exception: $e');
yield Left<Failure, Success>(DeleteMultipleMailboxFailure(e)); yield Left<Failure, Success>(DeleteMultipleMailboxFailure(e));
} }
} }

Some files were not shown because too many files have changed in this diff Show More