Skip to content

Commit

Permalink
refactor(jsonschema): change error returned from json.Unmarshal to wr…
Browse files Browse the repository at this point in the history
…apped error (#83) (#85)

this allows the caller get to the underlying error
  • Loading branch information
aakhan1 authored Oct 28, 2020
1 parent 69ae567 commit 08d62a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 08d62a2

Please sign in to comment.