lib/hanami/view/standalone_view.rb in hanami-view-2.0.0.alpha2 vs lib/hanami/view/standalone_view.rb in hanami-view-2.0.0.alpha3

- old
+ new

@@ -349,13 +349,17 @@ locals = locals(template_env, input) output = env.template(config.template, template_env.scope(config.scope, locals)) if layout? layout_env = self.class.layout_env(format: format, context: context) - output = env.template( - self.class.layout_path, - layout_env.scope(config.scope, layout_locals(locals)) - ) { output } + begin + output = env.template( + self.class.layout_path, + layout_env.scope(config.scope, layout_locals(locals)) + ) { output } + rescue TemplateNotFoundError + raise LayoutNotFoundError.new(config.layout, config.paths) + end end Rendered.new(output: output, locals: locals) end