module WarpEngine::ApiErrorRendering

Controller concern that turns exceptions into JSON error responses.

Including it installs rescue_from handlers that render { "error": ... } with:

ActiveRecord::RecordNotFound, Errno::ENOENT

404 Not found

ArgumentError

400 with the exception message

any other StandardError

500 Internal server error, after logging the exception