-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to teach v2 how to mostly reproduce v1 errors, add internal.{TransformMarshalError,NewMarshalerError,TransformUnmarshalError} that can be called by v2 to transform a v2 error into a v1 error. These injected functions are only ever called if ReportLegacyErrorValues is set. TransformMarshalError and TransformUnmarshalError are called in the top-level Marshal or Unmarshal functions if an error occurs. NewMarshalerError is called if a user-defined Marshal method fails. A JSONValue field is added to v2 SemanticError hold the entire copy of an invalid JSON value during unmarshal. This is primarily populated when trying to coerce a JSON number or string into a numeric value. This field is needed to faithfully reproduce a v1 UnmarshalTypeError, which sometimes holds the JSON value in the Value field. The error positioning stored in UnmarshalTypeError was fixed such that it is derived from the JSON pointer. However, instead of being '/'-delimited, it remains '.'-delimited to be consistent with historical precedence. Unlike before, the position now includes Go array, slice, and map indexes. Note that the positioning information in UnmarshalTypeError has always been inconsistent and has also been unstable, so hopefully changing this is okay.
- Loading branch information
Showing
17 changed files
with
426 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.