Skip to content

Commit 696fddc

Browse files
authored
add verbosity (#641)
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
1 parent c174978 commit 696fddc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/module_manager/go_hook/filter_result.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type Wrapped struct {
2222

2323
var (
2424
ErrEmptyWrapped = errors.New("empty filter result")
25-
ErrUnmarshalToTypesNotMatch = errors.New("unmarshal error: input and output types not match")
25+
ErrUnmarshalToTypesNotMatch = errors.New("input and output types not match")
2626
)
2727

2828
func (f *Wrapped) UnmarshalTo(v any) error {
@@ -44,7 +44,8 @@ func (f *Wrapped) UnmarshalTo(v any) error {
4444
}
4545

4646
if rw.Type() != rv.Type() {
47-
return ErrUnmarshalToTypesNotMatch
47+
return fmt.Errorf("input type: %s, wrapped type: %s: %w",
48+
rv.Type(), rw.Type(), ErrUnmarshalToTypesNotMatch)
4849
}
4950

5051
rv.Elem().Set(rw.Elem())

pkg/module_manager/go_hook/filter_result_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func Test_FilterResult(t *testing.T) {
8989

9090
err := w.UnmarshalTo(os)
9191
assert.Error(t, err)
92+
assert.Equal(t, err.Error(), "input type: *go_hook_test.OtherStruct, wrapped type: *go_hook_test.SomeStruct: input and output types not match")
9293
})
9394

9495
t.Run("UnmarshalTo_CustomStructWithMap", func(t *testing.T) {

0 commit comments

Comments
 (0)