Reclassify actor-class-as-entrypoint error as JSG TypeError#6400
Open
Reclassify actor-class-as-entrypoint error as JSG TypeError#6400
Conversation
Contributor
|
Good — the 500 response is still expected, confirming no user-visible behavioral change. This is a small, well-scoped change:
LGTM |
kentonv
reviewed
Mar 24, 2026
9b8ce63 to
cdcc975
Compare
cdcc975 to
aad45ba
Compare
Pass isDynamicDispatch bool from newWorkerEntrypoint() into getExportedHandler(), covering both the HTTP/connect path (via WorkerEntrypoint) and the JS RPC path (via JsRpcSessionCustomEvent and EntrypointJsRpcTarget). The flag is passed as a parameter to CustomEvent::run() so every implementation is required at the call site to forward it explicitly to getExportedHandler(). All other CustomEvent::run() implementations (trace, queue, hibernatable-web-socket, tail-stream) also pass it through for consistency and forward-compatibility.
…atch When isDynamicDispatch is true (entrypoint name supplied at request time), two errors in getExportedHandler() are reclassified as JSG TypeErrors so they surface to the caller rather than being logged as internal errors. This will inform users about their likely misconfiguration: - A DO class name requested via the non-actor dispatch path - A non-existent entrypoint name For static dispatch (isDynamicDispatch false) both cases retain their existing LOG_ERROR_PERIODICALLY behaviour, since they can reflect genuine bugs or infrastructure failures.
aad45ba to
c6f39f9
Compare
Merging this PR will improve performance by 12.32%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | Encode_ASCII_1024[TextEncoder][0/0/1024] |
3.6 ms | 3.2 ms | +12.32% |
Comparing akapuscinska/fix-misclassified-error (c6f39f9) with main (0d830b1)
Footnotes
-
129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"worker is not an actor but class name was requested" was logged via LOG_ERROR_PERIODICALLY, causing it to hit Sentry as an internal error. This is a user/config mistake (a DO class requested through the non-actor dispatch path), so it should be a JSG TypeError surfaced to the caller instead.