Exception: Straides::ReturnHttpCodeError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/straides/return_http_code_error.rb

Overview

A custom exception for bubbling up HTTP errors and showing the corresponding error pages.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(render_options = {}) ⇒ ReturnHttpCodeError

Returns a new instance of ReturnHttpCodeError.

Parameters:

  • render_options (Hash) (defaults to: {})


11
12
13
# File 'lib/straides/return_http_code_error.rb', line 11

def initialize(render_options = {})
  @render_options = render_options
end

Instance Attribute Details

#render_optionsObject

Returns the value of attribute render_options.



6
7
8
# File 'lib/straides/return_http_code_error.rb', line 6

def render_options
  @render_options
end

Instance Method Details

#has_template?true, false

Checks if error options contain any templates assigned to it.

Returns:

  • (true, false)


18
19
20
# File 'lib/straides/return_http_code_error.rb', line 18

def has_template?
  (render_options.keys & [:file, :text, :json, :nothing]).any?
end