-
Notifications
You must be signed in to change notification settings - Fork 2
Improved error handeling #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Improved error handeling #1094
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
439db22
improved error handeling
lodewiges caf808a
The last update made it static this looks better
lodewiges dce8de7
delete static error pages
lodewiges 708d6d5
fix lint
lodewiges 452d5e1
improve the error handling in the error controller
lodewiges 3b453d1
fix lint
lodewiges dbd7e62
added dedicated 422 unprocessable entity error pag
lodewiges f58f7e1
fixed lint and used dutch language for error page
lodewiges File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,34 @@ | ||
| class ErrorsController < ApplicationController | ||
| layout 'errors' | ||
|
|
||
| rescue_from StandardError, with: :handle_rendering_error | ||
|
|
||
| def forbidden | ||
| render status: :forbidden | ||
| render_error_page('errors/forbidden', :forbidden, '403 Forbidden') | ||
| end | ||
|
|
||
| def not_found | ||
| render status: :not_found | ||
| render_error_page('errors/not_found', :not_found, '404 Not Found') | ||
| end | ||
|
|
||
| def unacceptable | ||
| render status: :unprocessable_content | ||
| render_error_page('errors/unacceptable', :not_acceptable, '406 Not Acceptable') | ||
| end | ||
|
|
||
| def unprocessable_entity | ||
| render_error_page('errors/unprocessable_entity', :unprocessable_entity, '422 Unprocessable Entity') | ||
| end | ||
|
|
||
| def internal_server_error | ||
| render status: :internal_server_error | ||
| render_error_page('errors/internal_server_error', :internal_server_error, '500 Internal Server Error') | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def render_error_page(template, status, fallback_message) | ||
| render template: template, status: status | ||
| rescue StandardError => e | ||
| Rails.logger.error("Error rendering #{status} page: #{e.message}") | ||
| render plain: fallback_message, status: status | ||
| end | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <% content_for :title, "Verzoek niet verwerkt (422) - #{Rails.application.config.x.site_name}" %> | ||
| <h1>Verzoek niet verwerkt <small>(422)</small></h1> | ||
| <p>Je verzoek kon niet worden verwerkt. Dit komt meestal door ongeldige gegevens.</p> | ||
| <p>Controleer je invoer en probeer het opnieuw. Stuur een <%= link_to 'mailtje', "mailto:#{Rails.application.config.x.admin_email}" %> naar de ICT-commissie als dit probleem blijft optreden.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.