-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Various async fs functions don't have stack trace in resultant Error #34817
Comments
This happens because the error is generated when the underlying fs call finishes, asynchronously, while the stack is empty. |
devsnek
added
fs
Issues and PRs related to the fs subsystem / file system.
question
Issues that look for answers.
labels
Aug 18, 2020
This looks like the question was answered and there has been no follow up questions for more than a year. Closing, please let me know if you think that was not the right thing to do. |
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Sep 25, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Oct 12, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817
nodejs-github-bot
pushed a commit
that referenced
this issue
Oct 26, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: #34817 PR-URL: #49849 Fixes: #50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
alexfernandez
pushed a commit
to alexfernandez/node
that referenced
this issue
Nov 1, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
targos
pushed a commit
that referenced
this issue
Nov 11, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: #34817 PR-URL: #49849 Fixes: #50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Dec 12, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Dec 12, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Backport-PR-URL: nodejs#51127 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Dec 12, 2023
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Backport-PR-URL: nodejs#51127 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Mar 26, 2024
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Backport-PR-URL: nodejs#51127 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sapphi-red
added a commit
to sapphi-red/node
that referenced
this issue
Mar 26, 2024
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: nodejs#34817 PR-URL: nodejs#49849 Backport-PR-URL: nodejs#51127 Fixes: nodejs#50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
marco-ippolito
pushed a commit
that referenced
this issue
Apr 29, 2024
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling Error.captureStacktrace and re-throwing the error. Refs: #34817 PR-URL: #49849 Backport-PR-URL: #51127 Fixes: #50160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the bug?
This case will test fs.readdir. I've also noticed similar problems with lstat (by statting a nonexistent file) and readFile (with a directory as its first parameter).
Create a file (in this case, it is in the same folder as the script, aptly named 'someExistingFile')
Output (the Errors are expected):
How often does it reproduce? Is there a required condition?
Every time. The required condition is having
./someExistingFile
be an existing file, not a folder.What is the expected behavior?
Print the stack trace of where the error occurred.
What do you see instead?
In the case of console.log(e):
In the case of console.log(e.stack):
Error: ENOTDIR: not a directory, scandir '/Users/brett/someExistingFile'
The text was updated successfully, but these errors were encountered: