controller
controller copied to clipboard
Raise error for missing view
Before:
view = nil
response.render(view)
# #<NoMethodError: undefined method `call' for nil:NilClass>
After
view = nil
response.render(view)
#<Hanami::Controller::MissingViewError: Cannot render a view that is missing>
We should provide helpful errors to users when possible.
(This came about from implementing the spec for #355)
Happy to change the wording
Thanks @jodosha. I just implemented the line you asked for, though I'm not sure it's what you were looking for. I feel like it might make sense to surface the where the Action looked for views, rather than just the name of the class (which will show up in the stacktrace anyway).
Also happy to re-implement the spec in a different way, stubbing out class
as a String isn't terrific.