Skip to content

Commit e74b91e

Browse files
committed
fix(rivetkit): explicitly handle errors in _onStop (#3325)
1 parent f10b0f5 commit e74b91e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

rivetkit-typescript/packages/rivetkit/src/drivers/engine/actor-driver.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
type LongTimeoutHandle,
4646
promiseWithResolvers,
4747
setLongTimeout,
48+
stringifyError,
4849
} from "@/utils";
4950
import { KEYS } from "./kv";
5051
import { logger } from "./log";
@@ -427,7 +428,14 @@ export class EngineActorDriver implements ActorDriver {
427428

428429
const handler = this.#actors.get(actorId);
429430
if (handler?.actor) {
430-
await handler.actor._onStop();
431+
try {
432+
await handler.actor._onStop();
433+
} catch (err) {
434+
logger().error({
435+
msg: "error in _onStop, proceeding with removing actor",
436+
err: stringifyError(err),
437+
});
438+
}
431439
this.#actors.delete(actorId);
432440
}
433441

0 commit comments

Comments
 (0)