Created
April 18, 2014 18:52
-
-
Save ronshapiro/11059002 to your computer and use it in GitHub Desktop.
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
{ | |
message: "There was an error.", //top level, localized | |
errors: [ | |
{ | |
hierarchy: ["card", "address"], // list of categories; hierarchy.length > 0 | |
code: 456, | |
message: "Your billing address is invalid." | |
}, | |
{ | |
hierarchy: ["card", "expiration"], | |
code: 789, | |
message: "Your card has expired." | |
}, | |
{ | |
hierarchy: ["amount"] | |
code: 123 | |
message: "Negative amounts are not valid, please pay someone positive moneyz." | |
} | |
] | |
} |
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
{ | |
message: "There was an error.", //top level | |
fieldErrors: [ | |
{ | |
field: "card", | |
fieldErrors: [ | |
{ | |
// this is the base error type, but can be nested to arbitrary depths | |
field: "address", | |
code: 456, | |
message: "Your billing address is invalid." | |
}, | |
{ | |
field: "expiration", | |
code: 789, | |
message: "Your card has expired." | |
} | |
] | |
}, | |
{ | |
// same base error, but not nested as deep | |
field: "amount", | |
code: 123, | |
message: "Negative amounts are not valid, please pay someone positive moneyz." | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment