...
1package shared
2
3type MyError struct {
4 stack *stacktrace
5 err error
6}
7
8func (me *MyError) Error() string {
9 return fmt.Sprintf("%w", me.err)
10}
11
12type WrappedError struct {
13 wrapped_at string
14 err error
15}
16
17func (we *WrappedError) Error() string {
18 return we.String()
19}
20func (we *WrappedError) String() string {
21 if we == nil {
22 return "[noerror]"
23 }
24 s := fmt.Sprintf("[%s] %v", we.wrapped_at, we.err)
25 wo, ok := we.err.(*WrappedError)
26 if ok {
27 s = s + "->" + wo.String()
28 }
29 return s
30}
View as plain text