From 44458fcfa85e16b68e64e6bf4965fa2966926aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Caakhan1=E2=80=9D?= Date: Mon, 26 Oct 2020 21:31:00 -0400 Subject: [PATCH] refactor(jsonschema): change error returned from json.Unmarshal to wrapped error (#83) 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