dart-lang / dart-lang/webdev

Handle loading errors gracefully

Open
#1,136 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
224
Forks
94
Avg merge
7h 14m
Merged PRs (30d)
2

Description

In webdev (and I suppose flutter can encounter the same), if metadata reader (or anything else during loading the bootstrap
file) throws an exception, we get an empty page in chrome that does not get closed, and an exception in the daemon logs that shows in the VSCode debug console window (see below). We probably need to add some error handling callback from the dwds caller that is called to handle those errors properly, and also finish it up with closing all the services.

[INFO] Loading debug metadata...
[WARNING] Failed to read metadata: BLAH!
ERROR - 2020-10-07 12:11:11.377848
GET /main.dart.bootstrap.js
Error thrown by handler.
Exception: BLAH!
MetadataProvider._addMetadata
package:dwds/…/metadata/provider.dart:161
MetadataProvider.initialize.
package:dwds/…/metadata/provider.dart:126
===== asynchronous gap ===========================
MetadataProvider.initialize.
dart:async new Future.sync
AsyncMemoizer.runOnce
package:async/src/async_memoizer.dart:43
MetadataProvider.initialize
package:dwds/…/metadata/provider.dart:106
BuildRunnerRequireStrategyProvider._moduleProvider
package:dwds/…/loaders/build_runner_require.dart:56
RequireStrategy._requireLoaderSetup
package:dwds/…/loaders/require.dart:198
RequireStrategy.bootstrapFor
package:dwds/…/loaders/require.dart:191
DwdsInjector.middleware..
package:dwds/…/handlers/injector.dart:92
===== asynchronous gap ===========================
DwdsInjector.middleware..
interceptFavicon.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the failed bootstrap request through package:dwds/.../metadata/provider.dart, loaders/build_runner_require.dart, loaders/require.dart, and handlers/injector.dart. Reproduce a metadata-loading exception and determine how the DWDS caller should report it; done means the failure is handled instead of leaving an empty Chrome page, and the services are closed.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
tooling, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.