When an error occurs in Rails API Only, the server responds with an error in json with the following format: {"status":500,"error":"Internal Server Error"}.
The format is the same for other errors as well: {"status":404,"error":"Not Found"}.
I want to render the errors with the format: {"errors": [{status: 404, title: "Not found"}]}.
Basically I want to change the format of all errors to be the same and I don't find a way to do that.
I know I can use (for example) rescue_from ActiveRecord::RecordNotFound, with: :my_method and override the single exceptions but this means I have to list all possible exceptions and return the appropriate code, when Rails is already doing that.
What I am looking for is a method that can be overridden, and that I can use to change the "default" error format of Rails.