import { SupervisionContext } from "./actor" ; import { Ref } from "./references" ; export const SupervisionActions = { stop : Symbol ( 'stop' ) , stopAll : Symbol ( 'stopAll' ) , stopChild : Symbol ( 'stopChild' ) , stopAllChildren : Symbol ( 'stopAllChildren' ) , escalate : Symbol ( 'escalate' ) , resume : Symbol ( 'resume' ) , reset : Symbol ( 'reset' ) , resetAll : Symbol ( 'resetAll' ) , resetChild : Symbol ( 'resetChild' ) , resetAllChildren : Symbol ( 'resetAllChildren' ) } ; export function defaultSupervisionPolicy ( msg , err , ctx , child = undefined ) { let path = ctx . path . toString ( ) ; if ( child ) { console . log ( `${ path }: The following error was escalated when raised by child '${ child . path . parts [ child . path . parts . length - 1 ] }' processing message %O:\n%O\nTerminating faulted actor` , msg , err ) ; } else { console . log ( `${ path }: The following error was raised when processing message %O:\n%O\nTerminating faulted actor` , msg , err ) ; } return ctx . stop ; } ;