diff --git a/CHANGELOG.md b/CHANGELOG.md index b0a24cf..8085c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 3.4.2 +- Bugfix: unhandled exception during pre-error handling + ## 3.4.1 - Added error handling to avoid looping diff --git a/lib/configure_logging_for_browser.dart b/lib/configure_logging_for_browser.dart index d2dfcf5..6490f10 100644 --- a/lib/configure_logging_for_browser.dart +++ b/lib/configure_logging_for_browser.dart @@ -26,22 +26,27 @@ class ConfigureLoggingForBrowser { static final JsConsoleProxy _consoleProxy = new JsConsoleProxy(); static void collectPreStartJsErrors(LoggingService loggingService) { - if (loggingServiceJsPreStartErrorsList is List) { - loggingServiceJsPreStartErrorsList.forEach((error) { - if (error is! html.Event) { - loggingService.handleLogRecord( - new log.LogRecord( - log.Level.SEVERE, - 'collectPreStartJsErrors: the error event has incorrect type: ${error.runtimeType}/${error.toString()}', - 'jsPreStartUnhandledErrorLogger', - error, - ), - ); - return null; - } + if (loggingServiceJsPreStartErrorsList != null) { + for (final error in loggingServiceJsPreStartErrorsList) { + try { + if (error is! html.Event) { + loggingService.handleLogRecord( + new log.LogRecord( + log.Level.SEVERE, + 'collectPreStartJsErrors: the error event has incorrect type: ${error.runtimeType}/${error.toString()}', + 'jsPreStartUnhandledErrorLogger', + error, + ), + ); + return null; + } - _handleJsError(error as html.Event, loggingService, 'jsPreStartUnhandledErrorLogger'); - }); + _handleJsError(error as html.Event, loggingService, 'jsPreStartUnhandledErrorLogger'); + } + on Error catch(e) { + print('ConfigureLoggingForBrowser.collectPreStartJsErrors catch exception $e'); + } + } loggingServiceIsJsPreStartErrorSavingEnabled = false; loggingServiceJsPreStartErrorsList.clear(); } diff --git a/pubspec.yaml b/pubspec.yaml index e824fb2..b735706 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: logging_service -version: 3.4.1 +version: 3.4.2 description: The service for advanced work with logging authors: - Ivan Evsikov