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

Better errors when failing to parse a wit directory #442

Open
bakkot opened this issue May 31, 2024 · 0 comments
Open

Better errors when failing to parse a wit directory #442

bakkot opened this issue May 31, 2024 · 0 comments

Comments

@bakkot
Copy link

bakkot commented May 31, 2024

I wanted to try the fancy new feature to generate types from a directory, so I made a directory with two .wit files and ran node src/jco.js types ./wit-dir -o ./types, which produced

(jco types) ComponentError: failed to parse package: /code/jco/wit-dir
    at generateTypes (file:///code/jco/obj/js-component-bindgen-component.js:3976:11)
    at typesComponent (file:///code/jco/src/cmd/transpile.js:45:29)
    at async types (file:///code/jco/src/cmd/transpile.js:18:17)
    at async file:///code/jco/src/jco.js:186:9

Which is really not a helpful error.

Eventually by looking at the tests folder I was able to figure out that I'm supposed to have a single .wit file at the top level of wit-dir and put other files under the deps folder, but I don't know how I was supposed to figure that out without looking at the tests.


Also, on a related note, when there's a syntax error in the top-level .wit file it says failed to parse package:/code/jco/wit-dir rather than naming the file, or giving any information about what the error is.

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

1 participant