diff --git a/lib/roda/plugins/exception_page.rb b/lib/roda/plugins/exception_page.rb index c9abd524..e48db6d8 100644 --- a/lib/roda/plugins/exception_page.rb +++ b/lib/roda/plugins/exception_page.rb @@ -411,7 +411,7 @@ def exception_page_js private - if RUBY_VERSION >= '3.2' + if Exception.method_defined?(:detailed_message) def exception_page_exception_message(exception) exception.detailed_message(highlight: false).to_s end diff --git a/spec/plugin/exception_page_spec.rb b/spec/plugin/exception_page_spec.rb index 7fd4dc3a..b26a573e 100644 --- a/spec/plugin/exception_page_spec.rb +++ b/spec/plugin/exception_page_spec.rb @@ -15,7 +15,7 @@ def req(path = '/', headers={}) end end - message = RUBY_VERSION >= '3.2' ? "foo (RuntimeError)" : "foo" + message = Exception.method_defined?(:detailed_message) ? "foo (RuntimeError)" : "foo" it "returns HTML page with exception information if text/html is accepted" do ep_app