Skip to content

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

Open
@dario-piotrowicz

Description

@dario-piotrowicz

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);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions