Exception: TbCore::RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- TbCore::RequestError
- Defined in:
- lib/tb_core/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#item ⇒ Object
Returns the value of attribute item.
-
#request_url ⇒ Object
Returns the value of attribute request_url.
-
#template ⇒ Object
Returns the value of attribute template.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(item_or_opts = 'page', opts = {}) ⇒ RequestError
constructor
For compatability reasons, this method accepts multiple styles of inputs Going forward the expected input will be:.
Constructor Details
#initialize(item_or_opts = 'page', opts = {}) ⇒ RequestError
For compatability reasons, this method accepts multiple styles of inputs Going forward the expected input will be:
-
item: The item that could not be found. String. (default = page)
-
template (named): ERB template you wish to render
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tb_core/errors.rb', line 13 def initialize(item_or_opts='page', opts={}) if item_or_opts.is_a?(Hash) @item = item_or_opts[:item] @template = item_or_opts[:template] else @item = item_or_opts @template = opts[:template] end @template ||= 'layouts/error_page' @title = I18n.t(:title, scope: [:tb_core, :errors, @i18n]) super(I18n.t(:message, scope: [:tb_core, :errors, @i18n], item: @item)) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/tb_core/errors.rb', line 5 def code @code end |
#item ⇒ Object
Returns the value of attribute item.
4 5 6 |
# File 'lib/tb_core/errors.rb', line 4 def item @item end |
#request_url ⇒ Object
Returns the value of attribute request_url.
4 5 6 |
# File 'lib/tb_core/errors.rb', line 4 def request_url @request_url end |
#template ⇒ Object
Returns the value of attribute template.
4 5 6 |
# File 'lib/tb_core/errors.rb', line 4 def template @template end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/tb_core/errors.rb', line 5 def title @title end |