jfinkels/flask-restless — pull request #364 by devkeh (2014-10-16 08:51:06+00:00)
Title: Added ability to add additional messages in the ProcessingException JSON response.

I wanted the ability to do my validations at the preprocessor level. Unfortunately the default behavior of the ProcessingException only included the ability to have a single message. I've extended the ProcessingException with an additional parameter `additional_messages=dict()` to pass through additional messages in the JSON body of the response.

```
validation_errors = {'errors': {'username': ['Already exists.'],
'email': ['Invalid email address.']}
'status': 422}

raise ProcessingException(description='Validation errors occurred.", code=422,
additional_messages=validation_errors)
```

Returns the following JSON response.

```
HTTP/1.0 422 UNPROCESSABLE ENTITY
Content-Type: application/json
Content-Length: 182
Server: Werkzeug/0.9.6 Python/3.4.2
Date: Thu, 16 Oct 2014 08:47:48 GMT

{
"errors": {
"email": [
"Invalid email address."
],
"username": [
"Already exists."
]
},
"message": "Validation errors occurred.",
"status": 422
}
```