Skip to content

Instantly share code, notes, and snippets.

@ksolo
Created November 7, 2012 19:07
Show Gist options
  • Save ksolo/4033679 to your computer and use it in GitHub Desktop.
Save ksolo/4033679 to your computer and use it in GitHub Desktop.
API Errors
# Example Error failing to validate the requesting client.
{
'errors' : [
'The client you are using did not sumbit a client code, please contact your Virtual Hold Administrator'
]
}
# Example Error failing to validate a model (User).
{
'errors' : [
'Password must be at least 6 characters long',
'First name can't be blank'
]
}
@bbrotherton
Copy link

I was mostly trying to get some more information.

What if we do something like this instead:

{
    "errors": [
        {"type":"v", "message":"x"},
        {"type":"v", "message":"other x"}
    ]
}

It would allow messages of multiple types to be passed and each would have its own type. It seems like each validation violation would be a separate "error".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment