Skip to content

fix: show error message above the stack when HMR overlay is disabled#3677

Merged
antfu merged 1 commit intovitejs:mainfrom
fwouts:improve-error-log
Jun 6, 2021
Merged

fix: show error message above the stack when HMR overlay is disabled#3677
antfu merged 1 commit intovitejs:mainfrom
fwouts:improve-error-log

Conversation

@fwouts
Copy link
Copy Markdown
Contributor

@fwouts fwouts commented Jun 4, 2021

Description

The error stack in ErrorPayload doesn't contain the original error message, as it's stripped out by the call to cleanStack (source). As a result, if the HMR overlay is disabled, the error message does not appear in console logs.

Therefore, the error message needs to be explicitly prepended.

Before

Screen Shot 2021-06-05 at 9 07 40 am

After

Screen Shot 2021-06-05 at 9 07 07 am

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@antfu antfu merged commit 6b4c355 into vitejs:main Jun 6, 2021
@fwouts fwouts deleted the improve-error-log branch June 6, 2021 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants