Catch exit hook failures
This commit is contained in:
parent
078c34632b
commit
f45ab47175
|
@ -158,7 +158,13 @@ export class Actor {
|
||||||
if (!reason.ok) {
|
if (!reason.ok) {
|
||||||
console.error(`${this} crashed:`, reason.err);
|
console.error(`${this} crashed:`, reason.err);
|
||||||
}
|
}
|
||||||
this.exitHooks.forEach(hook => hook());
|
this.exitHooks.forEach(hook => {
|
||||||
|
try {
|
||||||
|
hook();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`${this} exit hook ${hook} failed:`, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.root._terminate(reason.ok);
|
this.root._terminate(reason.ok);
|
||||||
this.space.deregister(this);
|
this.space.deregister(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue