From 2beecfc78e74112cd5868d353b3a281300e1f5de Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 31 May 2021 12:01:50 +0200 Subject: [PATCH] Make actor *stop* an orderly termination (vs crash) --- src/runtime/actor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/actor.ts b/src/runtime/actor.ts index dc21a7b..f6b7fe0 100644 --- a/src/runtime/actor.ts +++ b/src/runtime/actor.ts @@ -60,11 +60,11 @@ export class Actor { terminateWith(t: Turn, reason: Exclude) { if (this.exitReason !== null) return; this.exitReason = reason; - if (!this.exitReason.ok) { - console.error(`Actor ${this.id} crashed:`, this.exitReason.err); + if (!reason.ok) { + console.error(`Actor ${this.id} crashed:`, reason.err); } this.exitHooks.forEach(hook => hook(t)); - queueTask(() => Turn.for(this.root, t => this.root._terminate(t, false), true)); + queueTask(() => Turn.for(this.root, t => this.root._terminate(t, reason.ok), true)); } }