I'm using a library to handle error responses across five different API apps. To stop all processing, this library raises an error that is later rescued with `rescue_from`.
Since DRY is important to me, I also want to avoid repeating the `rescue_from` call and its handler block in all five applications. Furthermore, if I someday decide to change the handler, I would need to update all five applications.
Solution I've found is to extend my error class with a `to_proc` method that generates a proc handling the response in the controller (in this case: `render json: exception.reply`). I've patched rails to this end: `rescue_from` can now be called without a block handler, in which case the block handler will be the proc of the exception.