-
Notifications
You must be signed in to change notification settings - Fork 4
/
error.go
41 lines (30 loc) · 1.33 KB
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package serviceapi
import (
"github.com/lyraproj/issue/issue"
"github.com/lyraproj/pcore/px"
)
type ErrorObject interface {
px.PuppetObject
// Kind returns the error kind
Kind() string
// Message returns the error message
Message() string
// IssueCode returns the issue code
IssueCode() string
// PartialResult returns the optional partial result. It returns
// pcore.UNDEF if no partial result exists
PartialResult() px.Value
// Details returns the optional details. It returns
// an empty map when no details exist
Details() px.OrderedMap
// ToReported checks if the IssueCode represents a known issue.Reported code in this executable,
// and if so, reconstructs the original error using the code and arguments and returns it and true.
//
// nil, false is returned if the IssueCode is unknown to the current executable.
ToReported() (issue.Reported, bool)
}
var ErrorFromReported func(c px.Context, err issue.Reported) ErrorObject
var NewError func(c px.Context, message, kind, issueCode string, partialResult px.Value, details px.OrderedMap) ErrorObject
// NotFound returns the special NotFound error which is recognized by the Lyra workflow engine. It should
// be used when requests are made to read, update, or delete a resource with an external id that no longer exists.
var NotFound func(typeName, extId string) error