Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: unhandled exception during pre-error handling #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 3.4.2
- Bugfix: unhandled exception during pre-error handling

## 3.4.1
- Added error handling to avoid looping

Expand Down
35 changes: 20 additions & 15 deletions lib/configure_logging_for_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Expand Down