a love letter to tangled (android, iOS, and a search API)
1package index
2
3import "fmt"
4
5type PermanentError struct {
6 Decision string
7 Err error
8}
9
10func (e *PermanentError) Error() string {
11 if e.Err == nil {
12 return e.Decision
13 }
14 return fmt.Sprintf("%s: %v", e.Decision, e.Err)
15}
16
17func (e *PermanentError) Unwrap() error {
18 return e.Err
19}
20
21func IsPermanent(err error) (*PermanentError, bool) {
22 perr, ok := err.(*PermanentError)
23 return perr, ok
24}