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

Incomplete stack traces with non static dynamic imports #20034

Closed
marvinhagemeister opened this issue Aug 3, 2023 · 2 comments
Closed

Incomplete stack traces with non static dynamic imports #20034

marvinhagemeister opened this issue Aug 3, 2023 · 2 comments
Labels
bug Something isn't working correctly

Comments

@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Aug 3, 2023

When a dynamic import is not statically analysable we run into a situation where the stack trace is incomplete when an error is thrown. The stack trace seems to stop at the first non static import.

Steps to reproduce

  1. Clone https://github.com/marvinhagemeister/deno-dynamic-import-error
  2. Run deno run -A main.ts

Actual error:

error: Uncaught (in promise) Error: No such file or directory (os error 2): readfile '/project/non-existant.json' at ext:deno_fs/30_fs.js:749:18

await import(url);
^
    at async file:https:///project/main.ts:2:1

Expected error:

error: Uncaught (in promise) Error: No such file or directory (os error 2): readfile '/project/non-existant.json'

await Deno.readTextFile(new URL("non-existant.json", base));
^
    at async Object.readTextFile (ext:deno_fs/30_fs.js:749:18)
    at async start (file:https:///project/thrower.ts:3:5)
    at async file:https:///project/indirect.ts:3:1
    at async file:https:///project/main.ts:2:1
@nayeemrmn
Copy link
Collaborator

Fixed in #20135.

@kt3k
Copy link
Member

kt3k commented Aug 14, 2023

Confirmed it's fixed

$ ~/denoland/deno/target/debug/deno run -A main.ts
Stack trace should point to Deno.readTextFile
error: Uncaught (in promise) NotFound: No such file or directory (os error 2): readfile '/Users/kt3k/tmp/deno-dynamic-import-error/non-existant.json'
    await Deno.readTextFile(new URL("non-existant.json", base));
    ^
    at async Object.readTextFile (ext:deno_fs/30_fs.js:749:18)
    at async start (file:https:///Users/kt3k/tmp/deno-dynamic-import-error/thrower.ts:3:5)
    at async file:https:///Users/kt3k/tmp/deno-dynamic-import-error/indirect.ts:3:1

@kt3k kt3k closed this as completed Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants