From d6243eb7afd5d9d91686bce2e02c252be456b38c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2022 02:41:14 -0600 Subject: better errors --- pkg/binstruct/size.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/binstruct/size.go') diff --git a/pkg/binstruct/size.go b/pkg/binstruct/size.go index 0119a7a..6563455 100644 --- a/pkg/binstruct/size.go +++ b/pkg/binstruct/size.go @@ -48,7 +48,8 @@ func staticSize(typ reflect.Type) (int, error) { if !(typ.Implements(marshalerType) || typ.Implements(unmarshalerType)) { return getStructHandler(typ).Size, nil } - fallthrough + return 0, fmt.Errorf("type=%v (kind=%v) does not implement binfmt.StaticSizer but does implement binfmt.Marshaler or binfmt.Unmarshaler", + typ, typ.Kind()) default: return 0, fmt.Errorf("type=%v does not implement binfmt.StaticSizer and kind=%v is not a supported statically-sized kind", typ, typ.Kind()) -- cgit v1.2.3-2-g168b