FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

module: wrap swc error in ERR_INVALID_TYPESCRIPT_SYNTAX by marco-ippolito · Pull Request #55316 · nodejs/node · GitHub

/ node Public

module: wrap swc error in ERR_INVALID_TYPESCRIPT_SYNTAX - #55316

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
marco-ippolito:error-handling-ts
Oct 10, 2024
Merged

module: wrap swc error in ERR_INVALID_TYPESCRIPT_SYNTAX#55316
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
marco-ippolito:error-handling-ts

Conversation

Copy link
Copy Markdown
Member

This PR wraps swc errors in a Node error to provide a more consistent error handling.

Before this PR

marcoippolito@marcos-MacBook-Pro node % node --experimental-strip-types -p "enum Foo{}"

node:internal/deps/amaro/dist/index:226
          throw takeObject(r1);
          ^
  x TypeScript enum is not supported in strip-only mode
   ,----
 1 | enum Foo{}
   : ^^^^^^^^^^
   `----

(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v22.8.0

After this PR

marcoippolito@marcos-MacBook-Pro node % ./node --experimental-strip-types -p "enum Foo{}"                      
node:internal/modules/helpers:390
    throw new ERR_INVALID_TYPESCRIPT_SYNTAX(error);
    ^

SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]:   x TypeScript enum is not supported in strip-only mode
   ,----
 1 | enum Foo{}
   : ^^^^^^^^^^
   `----

    at stripTypeScriptTypes (node:internal/modules/helpers:390:11)
    at node:internal/main/eval_string:27:3 {
  code: 'ERR_INVALID_TYPESCRIPT_SYNTAX'
}

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Oct 8, 2024
marco-ippolito added the strip-types Issues or PRs related to strip-types support label Oct 8, 2024

ShogunPanda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM!

codecov Bot commented Oct 8, 2024
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.90%. Comparing base (bbdfeeb) to head (902491b).
Report is 284 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55316      +/-   ##
==========================================
- Coverage   88.41%   87.90%   -0.52%     
==========================================
  Files         652      652              
  Lines      186612   186756     +144     
  Branches    36062    35789     -273     
==========================================
- Hits       165001   164170     -831     
- Misses      14885    15803     +918     
- Partials     6726     6783      +57     
Files with missing lines Coverage Δ
lib/internal/errors.js 94.29% <100.00%> (-2.69%) ⬇️
lib/internal/modules/helpers.js 98.20% <100.00%> (-0.82%) ⬇️

... and 110 files with indirect coverage changes

JakobJingleheimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 8, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 8, 2024

Copy link
Copy Markdown
Collaborator

marco-ippolito added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Oct 8, 2024
Comment thread lib/internal/modules/helpers.js Outdated
Comment thread doc/api/errors.md Outdated
Comment thread lib/internal/modules/helpers.js Outdated
Comment thread lib/internal/modules/helpers.js Outdated
marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 9, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 9, 2024

Copy link
Copy Markdown
Collaborator

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

Copy link
Copy Markdown
Collaborator

marco-ippolito added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 9, 2024
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 10, 2024
nodejs-github-bot merged commit 31a37e7 into nodejs:main Oct 10, 2024

Copy link
Copy Markdown
Collaborator

Landed in 31a37e7

aduh95 pushed a commit that referenced this pull request Oct 11, 2024
PR-URL: #55316
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 mentioned this pull request Oct 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. errors Issues and PRs related to JavaScript errors originated in Node.js core. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. strip-types Issues or PRs related to strip-types support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL