Exception: Fortitude::Errors::NoBlockToYieldTo

Inherits:
Base
  • Object
show all
Defined in:
lib/fortitude/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(widget, local_jump_exception = nil) ⇒ NoBlockToYieldTo

Returns a new instance of NoBlockToYieldTo.



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/fortitude/errors.rb', line 156

def initialize(widget, local_jump_exception = nil)
  @local_jump_exception = local_jump_exception
  @widget = widget

  message = %{You're trying to call 'yield' (or 'yield_from_widget', or the Erector-compatibility method 'call_block')
from the widget #{widget}; however, there is nothing to yield to. Fortitude
looks for something to yield to in this order:
  1. A block passed to a yield at render time directly (usually via the 'widget' call);
  2. A block passed to the constructor of the widget;
  3. The layout the widget is being rendered in.
None of these exist here, and so calling 'yield', 'yield_from_widget', or 'call_block' is an
undefined operation.}

  if @local_jump_exception
    message += %{

This was caused by a #{@local_jump_exception.class.name}, which is: #{@local_jump_exception}:\n
    #{@local_jump_exception.backtrace.join("\n    ")}}
  end

  super(message)
end

Instance Attribute Details

#widgetObject (readonly)

Returns the value of attribute widget.



154
155
156
# File 'lib/fortitude/errors.rb', line 154

def widget
  @widget
end