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: {})


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

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

Instance Attribute Details

#render_optionsObject

Returns the value of attribute render_options.



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

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)


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

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