Skip to content

Instantly share code, notes, and snippets.

@ronshapiro
Created April 18, 2014 18:52
Show Gist options
  • Save ronshapiro/11059002 to your computer and use it in GitHub Desktop.
Save ronshapiro/11059002 to your computer and use it in GitHub Desktop.
{
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."
}
]
}
{
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