Skip to content

fix: require button click to trigger intentional test exception#6752

Merged
FireLemons merged 1 commit intorubyforgood:mainfrom
costajohnt:fix/error-page-button
Mar 8, 2026
Merged

fix: require button click to trigger intentional test exception#6752
FireLemons merged 1 commit intorubyforgood:mainfrom
costajohnt:fix/error-page-button

Conversation

@costajohnt
Copy link
Contributor

@costajohnt costajohnt commented Mar 7, 2026

What changed

Resolves #6749

Previously, visiting /error immediately raised a StandardError, meaning the error page view never actually rendered. Now the page renders with a button that must be clicked to trigger the exception.

Changes

  • ErrorController: index action now renders the page; new create action raises the exception
  • config/routes.rb: Added POST /error route for the button action
  • app/views/error/index.html.erb: Updated view with a "Trigger Exception" button
  • spec/requests/error_spec.rb: Updated tests — GET renders successfully, POST raises the exception

Proof

Screenshot 2026-03-07 at 1 31 35 PM Screenshot 2026-03-07 at 1 31 47 PM

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 erb labels Mar 7, 2026
Previously, visiting /error immediately raised a StandardError.
Now the page renders with a button that must be clicked to trigger
the exception, preventing accidental error reports.

Resolves rubyforgood#6749
@costajohnt costajohnt force-pushed the fix/error-page-button branch from 5a443b0 to df511e5 Compare March 7, 2026 21:21
@costajohnt costajohnt marked this pull request as ready for review March 7, 2026 21:37
@FireLemons FireLemons merged commit 2645f39 into rubyforgood:main Mar 8, 2026
12 checks passed
@FireLemons
Copy link
Collaborator

Thanks. A bot kept posting the url and the link was visited for embeds which kept generating exceptions which made the bot report the link in a post causing a loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

erb ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button to trigger intentional exception

2 participants