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

Runtime raising TypeError instead of Deno.errors.NotFound #16737

Closed
jflatow opened this issue Nov 21, 2022 · 6 comments
Closed

Runtime raising TypeError instead of Deno.errors.NotFound #16737

jflatow opened this issue Nov 21, 2022 · 6 comments

Comments

@jflatow
Copy link
Contributor

jflatow commented Nov 21, 2022

When using the deno runtime crate (as recent as 0.86) I am definitely getting not found exceptions ("TypeError: No such file or directory (os error 2)") of a different error type than expected, which is causing things like fs.exists to fail. Working on a minimal reproduction, but figured worth filing this issue already as I'm 99% sure its a bug in the runtime, and may be helpful for others.

@lucacasonato
Copy link
Member

lucacasonato commented Nov 24, 2022

Make sure your errors are registered like this: https://github.com/denoland/deno/blob/main/runtime/js/99_main.js#L255 and you provide deno_core::JsRuntime with the correct get_error_class_name implementation (e.g https://github.com/denoland/deno/blob/main/runtime/errors.rs#L155)

Please re-open if this does not fix your issue.

@jflatow
Copy link
Contributor Author

jflatow commented Nov 25, 2022

Make sure your errors are registered like this: https://github.com/denoland/deno/blob/main/runtime/js/99_main.js#L255

Is there an example which explicitly loads these runtime modules?

@bartlomieju
Copy link
Member

Make sure your errors are registered like this: https://github.com/denoland/deno/blob/main/runtime/js/99_main.js#L255

Is there an example which explicitly loads these runtime modules?

Which modules are you asking about?

@jflatow
Copy link
Contributor Author

jflatow commented Nov 25, 2022

Make sure your errors are registered like this: https://github.com/denoland/deno/blob/main/runtime/js/99_main.js#L255

Is there an example which explicitly loads these runtime modules?

Which modules are you asking about?

All the modules in that directory (https://github.com/denoland/deno/tree/main/runtime/js), I naively would have thought they all got loaded somehow, but seems like that may not be the case given the situation with the errors. Although I think they still must be, or I wouldn't be able to use any of the things I am already using in the runtime.

If they are indeed being loaded, then I should re-open this issue, since adding the get_error_class_fn does not solve.

@CheatCod
Copy link

Were you able to figure out how to register the errors and get_error_class_name?

@jflatow
Copy link
Contributor Author

jflatow commented Jun 16, 2023

No, not reliably, I (unfortunately) ended up working around by matching error messages instead of trying to work with the error types

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

No branches or pull requests

4 participants