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

Remove usages of anyhow::Error in library code #810

Open
bartlomieju opened this issue Jul 8, 2024 · 1 comment · May be fixed by #878
Open

Remove usages of anyhow::Error in library code #810

bartlomieju opened this issue Jul 8, 2024 · 1 comment · May be fixed by #878
Labels

Comments

@bartlomieju
Copy link
Member

Instead any error type that needs to cross Rust->JS boundary should require to implement ToV8Error trait.

Example "footgun" usage:
https://github.com/denoland/deno_core/blob/0f7fced6e574393f2673461b6e9fc12a461eca23/core/error.rs#L126C8-L126C19

@dsherret
Copy link
Member

dsherret commented Jul 8, 2024

It would also be nice if I could have a rust type that implements this trait and define properties that should be set on the error object. For example, in this scenario I want to define code easily for JS on the Rust error type, but still use this error type mostly in Rust:

try {
  const test = require("#import-test");

} catch(err) {
  console.log(err);
  console.log(err.code); // ERR_PACKAGE_IMPORT_NOT_DEFINED
}

@crowlKats crowlKats linked a pull request Aug 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants