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

🐛 Bug Report/Feature Request: improve fallback service error message on js code compilation errors #2197

Open
dario-piotrowicz opened this issue May 30, 2024 · 0 comments
Assignees

Comments

@dario-piotrowicz
Copy link
Member

The module fallback service given code that contains a syntax error returns an error response saying that the requested module could not be found, instead of clearly saying that a compilation error occurred, while using the service I encountered this causing me confusion and making me question if my code was failing to correctly fetch the module, so I think it would be great if this could be improved.


minimal reproduction made by using miniflare


I think that the main issue is the fact that here on errors we simply only return a failed-to-fetch-module error:

} catch (...) {
auto exception = kj::getCaughtExceptionAsKj();
KJ_LOG(ERROR, "Fallback service failed to fetch module", exception, spec);
return kj::none;
}

I'm guessing that in order to catch syntax errors (or any possible errors?) and surface them correctly to the user we should try-catch this piece of code?

auto module = WorkerdApi::tryCompileModule(js, moduleBuilder, observer, featureFlags);

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

2 participants