From 38a9871a37a70a0307323018c6fb25425cb97a4d Mon Sep 17 00:00:00 2001 From: Uwe Kubosch Date: Tue, 31 Jan 2023 13:35:35 +0100 Subject: [PATCH] Display error message for rendering errors --- src/main/resources/ruby/slim_helper.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/resources/ruby/slim_helper.rb b/src/main/resources/ruby/slim_helper.rb index 6c228c7..ba64f44 100644 --- a/src/main/resources/ruby/slim_helper.rb +++ b/src/main/resources/ruby/slim_helper.rb @@ -135,11 +135,17 @@ def params.[](key) html end rescue Exception => e # rubocop: disable Lint/RescueException - LOG.error "Exception rendering view: #{rendering_context.url.inspect}" - LOG.error "#{e.class}: #{e.message}" - LOG.info e.backtrace.join("\n") - LOG.error e - raise + message = <<~HTML + Exception rendering view: #{rendering_context.url.inspect} + + #{e.class}: #{e.message} + + #{e} + + #{e.backtrace.join("\n")} + HTML + LOG.error message + "

Whoops!

#{message}
" end # self in this context is the Struct with the context variables