Class: RestfulError::ExceptionsController

Inherits:
SuperController
  • Object
show all
Defined in:
lib/restful_error/exceptions_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.controller_pathObject



3
# File 'lib/restful_error/exceptions_controller.rb', line 3

def self.controller_path = "restful_error"

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/restful_error/exceptions_controller.rb', line 8

def show
  @exception = request.env["action_dispatch.exception"]
  code = request.path_info[1..].to_i
  status = RestfulError.build_status_from_symbol_or_code(code)
  @status_code = status.code
  @reason_phrase = status.reason_phrase
  @response_message = @exception.try(:response_message) || RestfulError.localized_phrase(@exception.class.name, status) || nil

  render status: status.code, formats: request.format.symbol
end