feat(core): wrap prompt middleware in try-finally block
Ensure the prompt status is cleared even if the middleware chain throws an error.
This commit is contained in:
parent
a0b2003c65
commit
09c3fc443b
|
|
@ -87,17 +87,20 @@ export abstract class BaseGameClient<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback({
|
try {
|
||||||
hasPrompt: true,
|
callback({
|
||||||
player: ctx.player || "global",
|
hasPrompt: true,
|
||||||
def: ctx.def,
|
player: ctx.player || "global",
|
||||||
tryAnswer,
|
def: ctx.def,
|
||||||
});
|
tryAnswer,
|
||||||
await next();
|
});
|
||||||
callback({
|
return await next();
|
||||||
hasPrompt: false,
|
} finally {
|
||||||
player: ctx.player || "global",
|
callback({
|
||||||
});
|
hasPrompt: false,
|
||||||
|
player: ctx.player || "global",
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
selectStatus(callback: (status: ClientStatus) => void) {
|
selectStatus(callback: (status: ClientStatus) => void) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue