-
Notifications
You must be signed in to change notification settings - Fork 435
Description
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:
workerd/src/workerd/server/server.c++
Lines 2872 to 2876 in 1a99c34
} 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?
workerd/src/workerd/server/server.c++
Line 2866 in 1a99c34
auto module = WorkerdApi::tryCompileModule(js, moduleBuilder, observer, featureFlags); |