UNPKG

@ghostry/finity-core

Version:

Finite state management with exhaustiveness and transition enforcement for TypeScript.

1 lines 602 B
function t(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class e extends Error{constructor({reason:e,state:i,tick:n}){super([`[finity] Invalid (${e}) state transition`,i.name?`of "${i.name}"`:"",`from "${i.from.kind}"`,`to "${i.to.kind}"`,"stale"===e?`because the transition should have occurred at tick ${n.bound} but other state changes have advanced the tick to ${n.current}`:""].join(" ")),t(this,"reason",void 0),t(this,"state",void 0),t(this,"tick",void 0),this.reason=e,this.state=i,this.tick=n}}export{e as InvalidTransitionError};