Class: ExceptionHandler::Exception
- Inherits:
-
Object
- Object
- ExceptionHandler::Exception
- Defined in:
- app/services/exception_handler/exception.rb
Overview
Instance Attribute Summary collapse
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#code ⇒ Object
(also: #status)
Status code (404, 500 etc).
-
#initialize(request) ⇒ Exception
constructor
A new instance of Exception.
-
#response ⇒ Object
Server Response (“Not Found” etc).
Constructor Details
#initialize(request) ⇒ Exception
Returns a new instance of Exception.
7 8 9 10 11 12 13 |
# File 'app/services/exception_handler/exception.rb', line 7 def initialize request @request = request @exception = request.env['action_dispatch.exception'] @class = @exception.class @message = @exception. end |
Instance Attribute Details
#class ⇒ Object (readonly)
Returns the value of attribute class.
3 4 5 |
# File 'app/services/exception_handler/exception.rb', line 3 def class @class end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
3 4 5 |
# File 'app/services/exception_handler/exception.rb', line 3 def exception @exception end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'app/services/exception_handler/exception.rb', line 3 def @message end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
3 4 5 |
# File 'app/services/exception_handler/exception.rb', line 3 def request @request end |
Instance Method Details
#code ⇒ Object Also known as: status
Status code (404, 500 etc)
18 19 20 |
# File 'app/services/exception_handler/exception.rb', line 18 def code ActionDispatch::ExceptionWrapper.new(@request.env, @exception).status_code end |
#response ⇒ Object
Server Response (“Not Found” etc)
23 24 25 |
# File 'app/services/exception_handler/exception.rb', line 23 def response ActionDispatch::ExceptionWrapper.rescue_responses[@exception.class.name] end |