| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "errors" |
| 5 | "reasonix/desktop/internal/sessionui" |
| 6 | ) |
| 7 | |
| 8 | func sessionUIError(err error, target, operation string) error { |
| 9 | if err == nil { |
| 10 | return nil |
| 11 | } |
| 12 | if errors.Is(err, sessionui.ErrConflict) { |
| 13 | return &SessionOperationError{Code: "input_conflict", Message: "The input changed while saving. Please retry.", TargetKey: target, OperationID: operation} |
| 14 | } |
| 15 | if errors.Is(err, sessionui.ErrFutureVersion) { |
| 16 | return &SessionOperationError{Code: "unsupported_ui_schema", Message: "This input database requires a newer application. Its data has not been changed.", TargetKey: target, OperationID: operation} |
| 17 | } |
| 18 | return sessionOperationErrorForTarget(err, target, operation) |
| 19 | } |
| 20 |