dart_frog icon indicating copy to clipboard operation
dart_frog copied to clipboard

fix(vscode): surface error message in first launch

Open alestiago opened this issue 2 years ago • 0 comments

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

  1. Install dependencies (from: extensions/vscode):
npm i
  1. Run the Extension Development Host (Press F5).
  2. 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!');
}
  1. Debug the server
  2. 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

alestiago avatar Sep 14 '23 11:09 alestiago