File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ type ExtendedError interface {
12
12
}
13
13
14
14
type FormattedError struct {
15
- Message string `json:"message"`
16
- Locations []location.SourceLocation `json:"locations"`
17
- Path []interface {} `json:"path,omitempty"`
18
- Extensions map [string ]interface {} `json:"extensions,omitempty"`
15
+ Message string `json:"message"`
16
+ Locations []location.SourceLocation `json:"locations"`
17
+ Path []interface {} `json:"path,omitempty"`
18
+ Extensions map [string ]interface {} `json:"extensions,omitempty"`
19
+ originalError error
20
+ }
21
+
22
+ func (g FormattedError ) OriginalError () error {
23
+ return g .originalError
19
24
}
20
25
21
26
func (g FormattedError ) Error () string {
@@ -33,9 +38,10 @@ func FormatError(err error) FormattedError {
33
38
return err
34
39
case * Error :
35
40
ret := FormattedError {
36
- Message : err .Error (),
37
- Locations : err .Locations ,
38
- Path : err .Path ,
41
+ Message : err .Error (),
42
+ Locations : err .Locations ,
43
+ Path : err .Path ,
44
+ originalError : err ,
39
45
}
40
46
if err := err .OriginalError ; err != nil {
41
47
if extended , ok := err .(ExtendedError ); ok {
You can’t perform that action at this time.
0 commit comments