lib/roda/plugins/exception_page.rb in roda-3.65.0 vs lib/roda/plugins/exception_page.rb in roda-3.66.0
- old
+ new
@@ -225,20 +225,20 @@
js_file ||= "#{prefix}/exception_page.js"
end
css = case css_file
when nil
- "<style type=\"text/css\">#{ExceptionPage.css}</style>"
+ "<style type=\"text/css\">#{exception_page_css}</style>"
when false
# :nothing
else
"<link rel=\"stylesheet\" href=\"#{h css_file}\" />"
end
js = case js_file
when nil
- "<script type=\"text/javascript\">\n//<!--\n#{ExceptionPage.js}\n//-->\n</script>"
+ "<script type=\"text/javascript\">\n//<!--\n#{exception_page_js}\n//-->\n</script>"
when false
# :nothing
else
"<script type=\"text/javascript\" src=\"#{h js_file}\"></script>"
end
@@ -397,10 +397,20 @@
@_response['Content-Type'] = "text/plain"
"#{exception.class}: #{message}\n#{exception.backtrace.map{|l| "\t#{l}"}.join("\n")}"
end
end
+ # The CSS to use on the exception page
+ def exception_page_css
+ ExceptionPage.css
+ end
+
+ # The JavaScript to use on the exception page
+ def exception_page_js
+ ExceptionPage.js
+ end
+
private
if RUBY_VERSION >= '3.2'
def exception_page_exception_message(exception)
exception.detailed_message(highlight: false).to_s
@@ -418,14 +428,14 @@
module RequestMethods
# Serve exception page assets
def exception_page_assets
get 'exception_page.css' do
response['Content-Type'] = "text/css"
- ExceptionPage.css
+ scope.exception_page_css
end
get 'exception_page.js' do
response['Content-Type'] = "application/javascript"
- ExceptionPage.js
+ scope.exception_page_js
end
end
end
end