aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/process.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-26 17:12:02 +0900
committerOphestra <cat@gensokyo.uk>2025-02-26 17:12:02 +0900
commitd050b3de259c6ab1ebbee75eff1940dbbc84ced9 (patch)
tree695e75fe4a5e35bad42bc8c17e111ea52d22141b /internal/app/process.go
parent5de28800add32d2ac64446c05c805b04913fcc4f (diff)
app: define errors in a separate file
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/process.go')
-rw-r--r--internal/app/process.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/internal/app/process.go b/internal/app/process.go
index b0d60311..fe17f0b7 100644
--- a/internal/app/process.go
+++ b/internal/app/process.go
@@ -211,75 +211,3 @@ func (seal *outcome) Run(ctx context.Context, rs *fst.RunState) error {
return earlyStoreErr.equiv("cannot save process state:")
}
-
-// StateStoreError is returned for a failed state save
-type StateStoreError struct {
- // whether inner function was called
- Inner bool
- // returned by the Save/Destroy method of [state.Cursor]
- InnerErr error
- // returned by the Do method of [state.Store]
- DoErr error
- // stores an arbitrary store operation error
- OpErr error
- // stores arbitrary errors
- Err []error
-}
-
-// save saves arbitrary errors in [StateStoreError] once.
-func (e *StateStoreError) save(errs []error) {
- if len(errs) == 0 || e.Err != nil {
- panic("invalid call to save")
- }
- e.Err = errs
-}
-
-func (e *StateStoreError) equiv(a ...any) error {
- if e.Inner && e.InnerErr == nil && e.DoErr == nil && e.OpErr == nil && errors.Join(e.Err...) == nil {
- return nil
- } else {
- return fmsg.WrapErrorSuffix(e, a...)
- }
-}
-
-func (e *StateStoreError) Error() string {
- if e.Inner && e.InnerErr != nil {
- return e.InnerErr.Error()
- }
- if e.DoErr != nil {
- return e.DoErr.Error()
- }
- if e.OpErr != nil {
- return e.OpErr.Error()
- }
- if err := errors.Join(e.Err...); err != nil {
- return err.Error()
- }
-
- // equiv nullifies e for values where this is reached
- panic("unreachable")
-}
-
-func (e *StateStoreError) Unwrap() (errs []error) {
- errs = make([]error, 0, 3)
- if e.InnerErr != nil {
- errs = append(errs, e.InnerErr)
- }
- if e.DoErr != nil {
- errs = append(errs, e.DoErr)
- }
- if e.OpErr != nil {
- errs = append(errs, e.OpErr)
- }
- if err := errors.Join(e.Err...); err != nil {
- errs = append(errs, err)
- }
- return
-}
-
-// A RevertCompoundError encapsulates errors returned by
-// the Revert method of [system.I].
-type RevertCompoundError interface {
- Error() string
- Unwrap() []error
-}