phlex-ruby / phlex

A framework for building object-oriented views in Ruby.
https://beta.phlex.fun
MIT License
1.28k stars 83 forks source link

Omitting `view_template` method raises LocalJumpError #753

Closed thedumbtechguy closed 2 months ago

thedumbtechguy commented 2 months ago

I accidentally mistyped view_template and the error raised was confusing.

I've included the first portion of the stacktrace

ActionView::Template::Error (no block given (yield)):

Causes:
LocalJumpError (no block given (yield))
    1: <%= render current_definition.index_page_class.new %>

phlex (1.11.0) lib/phlex/sgml.rb:69:in `template'
phlex (1.11.0) lib/phlex/sgml.rb:79:in `view_template'
phlex (1.11.0) lib/phlex/sgml.rb:143:in `block (2 levels) in __final_call__'
phlex (1.11.0) lib/phlex/sgml.rb:319:in `around_template'
phlex (1.11.0) lib/phlex/sgml.rb:128:in `block in __final_call__'
phlex (1.11.0) lib/phlex/context.rb:28:in `around_render'
phlex (1.11.0) lib/phlex/sgml.rb:127:in `__final_call__'
phlex (1.11.0) lib/phlex/sgml.rb:97:in `call'
phlex (1.11.0) lib/phlex/sgml.rb:264:in `render'
phlex-rails (1.1.1) lib/phlex/rails/sgml/overrides.rb:20:in `render'
/Users/stefan/code/plutonium/starters/vulcan/gems/plutonium/lib/plutonium/ui/component/base.rb:18:in `phlexi_render'
joeldrapper commented 2 months ago

👍 We should definitely have a better error message for this.

joeldrapper commented 2 months ago

I pushed a fix up to the 1 branch. This is already fixed in main for 2.0.