Closed pancsta closed 2 months ago
Error handing is finally a thing, as pkg/rpc uses sentinel errors to trigger error states. Stack traces are nicely trimmed and logged.
pkg/rpc
func (h *handlers) ExceptionState(e *am.Event) { // call super h.ExceptionHandler.ExceptionState(e) mach := e.Machine err := e.Args["err"].(error) // handle sentinel errors to states if errors.Is(err, ErrNetwork) || errors.Is(err, ErrNetworkTimeout) { mach.Add1(ss.ErrNetwork, nil) } else if errors.Is(err, ErrInvalidParams) { mach.Add1(ss.ErrRpc, nil) } else if errors.Is(err, ErrInvalidResp) { mach.Add1(ss.ErrRpc, nil) } else if errors.Is(err, ErrRpc) { mach.Add1(ss.ErrRpc, nil) } }
Error handing is finally a thing, as
pkg/rpc
uses sentinel errors to trigger error states. Stack traces are nicely trimmed and logged.