Class: Hanami::Middleware::RenderErrors::RenderableException Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/middleware/render_errors.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception, responses:) ⇒ RenderableException

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RenderableException.

Since:

  • 2.1.0



28
29
30
31
# File 'lib/hanami/middleware/render_errors.rb', line 28

def initialize(exception, responses:)
  @exception = exception
  @responses = responses
end

Instance Attribute Details

#exceptionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



23
24
25
# File 'lib/hanami/middleware/render_errors.rb', line 23

def exception
  @exception
end

#responsesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



24
25
26
# File 'lib/hanami/middleware/render_errors.rb', line 24

def responses
  @responses
end

Instance Method Details

#rescue_response?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 2.1.0



35
36
37
# File 'lib/hanami/middleware/render_errors.rb', line 35

def rescue_response?
  responses.key?(exception.class.name)
end

#status_codeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



41
42
43
# File 'lib/hanami/middleware/render_errors.rb', line 41

def status_code
  Rack::Utils.status_code(responses[exception.class.name])
end