Custom failure messages should be controlled on CloudMailin
Currently, you can send back a custom failure message by responding with text/plain. The problem is, sometimes you do not have full control of error pages. For example, on Heroku, if there is a problem above your app on the Heroku side, they will throw an error message, with a pre-set error page that you define. This error page is always HTML, and is the same error across your entire app.
Therefore, perhaps in addition to returning a custom failure message, there could be a "default" error message that you set in your CloudMailin account, which will be used for any error response without a custom error message.
The error messages are something we really need to put some thought into. At the moment the error message isn’t pretty either. However there will be a default error message even if no error is returned. As a side note however errors are only relevant to 4xx status codes and all of these are controllable in heroku as they are thrown by your app.
We’ve added the ability to set details of a custom max size message however, we need to look into this as a possibility.