Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: file url in stack traces contains file:// #39787

Open
1 task
hyrious opened this issue Aug 17, 2021 · 2 comments
Open
1 task

doc: file url in stack traces contains file:// #39787

hyrious opened this issue Aug 17, 2021 · 2 comments

Comments

@hyrious
Copy link

@hyrious hyrious commented Aug 17, 2021

📗 API Reference Docs Problem

  • Version: v16.6.2

  • Platform: Darwin user.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

  • Subsystem: -

Location

Affected URL(s):

Description

The doc says

The location information will be one of:

  • native, if the frame represents a call internal to V8 (as in [].forEach).
  • plain-filename.js:line:column, if the frame represents a call internal to Node.js.
  • /absolute/path/to/file.js:line:column, if the frame represents a call in a user program, or its dependencies.

However the error stack trace actually contains file:// in es module files.
I'm not sure if it occurs in other situations.

Consider this input:

throw new Error("hello, world!");

Save and run node a.js:

/Users/hyrious/test-trace/a.js:1
throw new Error("hello, world!");
^

Error: hello, world!
    at Object.<anonymous> (/Users/hyrious/test-trace/a.js:1:7)

Save and run node a.mjs:

file:///Users/hyrious/test-trace/a.mjs:1
throw new Error("hello, world!");
      ^

Error: hello, world!
    at file:///Users/hyrious/test-trace/a.mjs:1:7

What I have to mention here is sindresorhus/clean-stack#27, using normal path would be better in many terminals. Please take that into consideration too.

My suggestion is node.js always returning normal path in error stack trace.


  • I would like to work on this issue and
    submit a pull request.
@Phantomghost1

This comment was marked as off-topic.

@prabhatmishra33
Copy link

@prabhatmishra33 prabhatmishra33 commented Oct 4, 2021

Hello! Is this open for contribution ? I would like to take up this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants