Skip to content

Commit 70108ad

Browse files
committed
cue/errors: convert more errors to cue/errors.Error
Change-Id: Iecd21974252dfac0ff1dd72e1ce40ddf107ee444 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2368 Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 2d9b769 commit 70108ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cue/errors/errors.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ func (e *posError) Cause() error { return e.err }
198198

199199
// Error implements the error interface.
200200
func (e *posError) Error() string {
201-
return e.Message.Error()
201+
if e.err == nil {
202+
return e.Message.Error()
203+
}
204+
return fmt.Sprintf("%s: %s", e.Message.Error(), e.err)
202205
}
203206

204207
// List is a list of Errors.

cue/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func unwrapJSONError(err error) errors.Error {
182182
case errors.Error:
183183
return &marshalError{x}
184184
default:
185-
return &marshalError{errors.Wrapf(err, token.NoPos, err.Error())}
185+
return &marshalError{errors.Wrapf(err, token.NoPos, "json error")}
186186
}
187187
}
188188

0 commit comments

Comments
 (0)