Closed
Description
📗 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.