Skip to content

Commit

Permalink
cmd/{rest,watcher},internal/celext: wrap errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Dec 31, 2024
1 parent f7d238a commit c8e24a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/rest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (extLib) decode(arg ref.Val) ref.Val {
var val any
err := json.Unmarshal(msg, &val)
if err != nil {
return types.NewErr("%v", err)
return types.NewErr("%w", err)
}
return types.DefaultTypeAdapter.NativeToValue(val)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func (l devLib) sleepState(arg ref.Val) ref.Val {
},
).Await(l.ctx, &resp)
if err != nil {
return types.NewErr("%v", err)
return types.NewErr("%w", err)
}
return types.NewDynamicMap(types.DefaultTypeAdapter, map[string]any{
"state": resp.Body.State,
Expand Down
4 changes: 2 additions & 2 deletions internal/celext/celext.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ func with(dst, src ref.Val) (res, other map[ref.Val]ref.Val, maybe ref.Val) {
new := make(map[ref.Val]ref.Val)
m, err := obj.ConvertToNative(refValMap)
if err != nil {
return nil, nil, types.NewErr("unable to convert dst to native: %v", err)
return nil, nil, types.NewErr("unable to convert dst to native: %w", err)
}
for k, v := range m.(map[ref.Val]ref.Val) {
new[k] = v
}
m, err = val.ConvertToNative(refValMap)
if err != nil {
return nil, nil, types.NewErr("unable to convert src to native: %v", err)
return nil, nil, types.NewErr("unable to convert src to native: %w", err)
}
return new, m.(map[ref.Val]ref.Val), nil
}
Expand Down

0 comments on commit c8e24a4

Please sign in to comment.