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

Show development mode exceptions with alert dialog for JavaScript requests #27381

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@mrhead
Contributor

mrhead commented Dec 16, 2016

Summary

Previously when an exception occurred for a SJR request, then no error was shown. You had to check the server log, or request information via browser's web development tools.

This PRs shows backend exceptions for SJR requests immediately in the alert dialog.

Before:

sjr-rails

After:

sjr-rails-improved

Other Information

  • I've tested it with Google Chrome, Safari and Firefox. It works great with all of them.
  • I've tested it with jquery_ujs and rails_ujs.
@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Dec 16, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @matthewd (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

rails-bot commented Dec 16, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @matthewd (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@carlosramireziii

This comment has been minimized.

Show comment
Hide comment
@carlosramireziii

carlosramireziii Jan 12, 2017

Contributor

@mrhead This seems like an excellent change to make SJR easier to use and debug.

I have been maintaining a gem called BetterSJR which aims to do just that. If this change does not make it in to Rails Core, I'd welcome a pull request to the gem to incorporate this functionality there.

https://github.com/carlosramireziii/better_sjr

Cheers!

Contributor

carlosramireziii commented Jan 12, 2017

@mrhead This seems like an excellent change to make SJR easier to use and debug.

I have been maintaining a gem called BetterSJR which aims to do just that. If this change does not make it in to Rails Core, I'd welcome a pull request to the gem to incorporate this functionality there.

https://github.com/carlosramireziii/better_sjr

Cheers!

@gmcgibbon

Still relevant in Rails 6 (bd139a5). I like the idea behind this change but I think it could use a refactor. If we're going to change this behaviour, it should be displaying errors in the console and not a modal.

@@ -93,7 +93,10 @@ def render_for_browser_request(request, wrapper)
template = create_template(request, wrapper)
file = "rescues/#{wrapper.rescue_template}"
if request.xhr?
if request.format == "text/javascript"

This comment has been minimized.

@gmcgibbon

gmcgibbon Jul 24, 2018

Member

You can do request.format.js?. I'm kind of disappointed, I don't see a request.js? 😦

@gmcgibbon

gmcgibbon Jul 24, 2018

Member

You can do request.format.js?. I'm kind of disappointed, I don't see a request.js? 😦

@@ -0,0 +1 @@
alert("<%= j yield %>");

This comment has been minimized.

@gmcgibbon

gmcgibbon Jul 24, 2018

Member

Modals are intrusive and annoying by design. If I was debugging a tricky error I wouldn't want it to keep popping up in a modal. The console would be a much more fitting place for error. Would you consider changing this to console.error or throw new Error?

@gmcgibbon

gmcgibbon Jul 24, 2018

Member

Modals are intrusive and annoying by design. If I was debugging a tricky error I wouldn't want it to keep popping up in a modal. The console would be a much more fitting place for error. Would you consider changing this to console.error or throw new Error?

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