...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package adapt
16
17 import "fmt"
18
19 type conversionError struct {
20 Location string
21 Details error
22 }
23
24 func (ce *conversionError) Error() string {
25 if ce.Location == "" {
26 return ce.Details.Error()
27 }
28 return fmt.Sprintf("conversion error in location %q: %v", ce.Location, ce.Details)
29 }
30
31 func (ce *conversionError) Unwrap() error {
32 return ce.Details
33 }
34
35 func newConversionError(loc string, err error) *conversionError {
36 return &conversionError{
37 Location: loc,
38 Details: err,
39 }
40 }
41
View as plain text