forked from capnproto/go-capnp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
30 lines (24 loc) · 918 Bytes
/
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
package capnp
import (
"capnproto.org/go/capnp/v3/exc"
)
// TODO(someday): progressively remove exported functions and instead
// rely on package 'exc'.
// Unimplemented returns an error that formats as the given text and
// will report true when passed to IsUnimplemented.
func Unimplemented(s string) error {
return exc.New(exc.Unimplemented, "", s)
}
// IsUnimplemented reports whether e indicates that functionality is unimplemented.
func IsUnimplemented(e error) bool {
return exc.TypeOf(e) == exc.Unimplemented
}
// Disconnected returns an error that formats as the given text and
// will report true when passed to IsDisconnected.
func Disconnected(s string) error {
return exc.New(exc.Disconnected, "", s)
}
// IsDisconnected reports whether e indicates a failure due to loss of a necessary capability.
func IsDisconnected(e error) bool {
return exc.TypeOf(e) == exc.Disconnected
}