How Box does error messages

Box has done a great job of standardizing their error messages. Whenever you get a bad response from Box, you can be sure that the format will be the same. It looks something like this:

{
    "type":"error",
    "status":400,
    "code":"bad_request",
    "context_info": {
        "errors": [
            {
                "reason": "expiration_not_allowed",
                "name": "unshared_at",
                "message": "Expiration cannot be set on a shared link",
                "location": "entity-body"
            },
            {
                "reason": "permissions_not_allowed",
                "name": "permissions",
                "message": "Permissions cannot be set on a shared link",
                "location": "entity-body"
            }
        ]
    },
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "Bad Request",
    "request_id":  "13628284550db80756c518"
}

There's a few great things about this. First, it does a great job of having multiple levels of errors: from computer readable to human readable.

However, my favorite part is that they have a help URL that sends people to a place that can help them diagnose the problem. They also have a request_id, which can be referenced when talking to their support.

Don't make people search for answers! Show them how to fix their problem right from the request.

You can learn more about how Box does error messages on their blog.