Change if/if to if/else-if when checking the type of JSON error
This commit is contained in:
parent
a3cf6bac36
commit
50c3bce98d
1 changed files with 1 additions and 2 deletions
|
@ -573,8 +573,7 @@ func templatingError(err error) error {
|
|||
if errors.As(err, &syntaxError) {
|
||||
// offset is arguably not super clear to the user, but it's the best we can do here
|
||||
cause = fmt.Errorf("%s at offset %d", cause.Error(), syntaxError.Offset)
|
||||
}
|
||||
if errors.As(err, &typeError) {
|
||||
} else if errors.As(err, &typeError) {
|
||||
// slightly rewriting the default error message to include the offset
|
||||
cause = fmt.Errorf("cannot unmarshal %s at offset %d into Go value of type %s", typeError.Value, typeError.Offset, typeError.Type)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue