fix(vscode): surface error message in first launch
Description
Sometimes, the developer's Dart Frog code might not be valid. This causes the server to fail serving such snapshot of the code. In such cases, the developer requires information regarding what went wrong. Right now, we surface these errors by logging them. The VS Code extension successfully logs such issues as long as it is not in the first launch. This means that, if the server fails to initially serve, then there is no feedback given regarding how to resolve the issue.
Steps To Reproduce
- Install dependencies (from: extensions/vscode):
npm i
- Run the Extension Development Host (Press F5).
- Open a Dart Frog project route and include an import statement that imports
dart:html
import 'dart:html';
import 'package:dart_frog/dart_frog.dart';
Response onRequest(RequestContext context) {
return Response(body: 'Welcome to Dart Frog!');
}
- Debug the server
- See error
Expected Behavior
There should be some feedback on how to resolve issues on first launch.
Demonstration
Feedback being logged as expected
https://github.com/VeryGoodOpenSource/dart_frog/assets/44524995/590b9676-ed54-414c-9a95-04d1695d9a11
Feedback not being logged in first launch
https://github.com/VeryGoodOpenSource/dart_frog/assets/44524995/fb497b47-f253-40ea-81cb-9909fb2a2c7e
Additional Context
- Initially reported by #1042