Errors when document save fails

The Redactor upload error events do not fire because the controllers are not sending the right response. This change triggers the right error callbacks and makes any errors e.g. those caused by trying to upload the wrong file type, available in the json response.