Class: Tungsten::ErrorsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tungsten::ErrorsController
- Includes:
- Gaffe::Errors
- Defined in:
- app/controllers/tungsten/errors_controller.rb
Instance Method Summary collapse
-
#show ⇒ Object
Render the correct template based on the exception “standard” code.
Instance Method Details
#show ⇒ Object
Render the correct template based on the exception “standard” code. Eg. For a 404 error, the ‘errors/not_found` template will be rendered.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/tungsten/errors_controller.rb', line 11 def show respond_to do |format| format.html do # Here, the `@exception` variable contains the original raised error render "tungsten/errors/#{@rescue_response}", status: @status_code end format.json do render json: { errors: @rescue_response }, status: @status_code end end end |