Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export class Conversation<
if (this.insideExternal) {
throw new Error(
"Cannot wait for updates from inside `external`, or concurrently to it! \
Bot API calls (e.g. ctx.api.*, ctx.reply) must not be made inside `external`. \
First return your data from `external` and then resume update handling using `wait` calls.",
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ export function cursor(state: ReplayState): ReplayCursor {
// replay existing data (do nothing)
const expected = state.send[send].payload;
if (expected !== payload) {
throw new Error(`Bad replay, expected op '${expected}'`);
throw new Error(
`Bad replay, expected op '${expected}' but got '${payload}'. \
This usually means a Bot API call (e.g. ctx.api.*, ctx.reply) was made inside \
\`conversation.external()\` or the conversation was otherwise used incorrectly.`,
);
}
} else { // send === state.send.length
// log new data
Expand Down