fix: mention Bot API calls in external wait-rejection error#150
Open
Dramex wants to merge 1 commit into
Open
Conversation
The error thrown when `wait` is invoked inside `external` explains that you must return from `external` first, but the most common way users hit this is by calling `ctx.api.*` (e.g. `getFile`, `reply`, chat actions) inside `external`. Those go through `wait` internally, so the symptom is opaque: you get a `wait` error from code that never called `wait`. Extend the message to call out Bot API calls explicitly so the fix is obvious. Closes grammyjs#148.
5cd4a3a to
79523e8
Compare
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.
Closes #148.
The existing error tells the caller to return from `external` before `wait`ing, but the most common way users hit it is by making a Bot API call inside `external` — `ctx.api.getFile`, `ctx.reply`, chat actions, etc. Those funnel through `wait` internally, so the symptom is an obscure `wait` error from code that never called `wait` directly. The reporter on #148 and the maintainer both confirmed this is the root cause.
Extend the message to call out Bot API calls explicitly, so the fix is obvious without a reader needing to know `wait` is what powers API calls under the hood.
Test plan