From 08d62a2939dc09a375c7f2ffa66e7b29fa8c2a7b Mon Sep 17 00:00:00 2001 From: Aman Khan <7885064+aakhan1@users.noreply.github.com> Date: Wed, 28 Oct 2020 10:26:41 -0400 Subject: [PATCH] refactor(jsonschema): change error returned from json.Unmarshal to wrapped error (#83) (#85) this allows the caller get to the underlying error --- schema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.go b/schema.go index 10dabe2..751a63f 100644 --- a/schema.go +++ b/schema.go @@ -325,7 +325,7 @@ func (s *Schema) validateSchemakeywords(ctx context.Context, currentState *Valid func (s *Schema) ValidateBytes(ctx context.Context, data []byte) ([]KeyError, error) { var doc interface{} if err := json.Unmarshal(data, &doc); err != nil { - return nil, fmt.Errorf("error parsing JSON bytes: %s", err.Error()) + return nil, fmt.Errorf("error parsing JSON bytes: %w", err) } vs := s.Validate(ctx, doc) return *vs.Errs, nil