Skip to content
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

Log internal web-console errors #181

Merged
merged 1 commit into from
Jan 16, 2016

Conversation

gsamokovarov
Copy link
Collaborator

Currently, if an error is hit in web-console internals, the user sees
the ActionPack::ShowExceptions middleware page and nothing else.
Having a log of the error within the Rails application log can help the
developers send us bug reports or take an action in resolving it.

Thanks to Richard Schneeman for the push and implementation.
Closes #178.

Currently, if an error is hit in web-console internals, the user see's
the `ActionPack::ShowExceptions` middleware page and nothing else.
Having a log of the error within the Rails application log can help the
developers send us bug reports or take an action in resolving it.

Thanks to Richard Schneeman for the push and implementation.
@rafaelfranca
Copy link
Member

LGTM

gsamokovarov added a commit that referenced this pull request Jan 16, 2016
@gsamokovarov gsamokovarov merged commit 6aa9dd6 into rails:master Jan 16, 2016
@schneems
Copy link
Member

❤️ thanks

@gsamokovarov gsamokovarov deleted the log-internal-errors branch January 27, 2016 11:10
gsamokovarov added a commit to gsamokovarov/rails that referenced this pull request May 19, 2017
What happens when your last resort error handling code crashes by
itself? This is a good question. Currently, Rails tries really hard to
at least show something to the browsers and not leave the end users with
a blank page.

For this to happen we have a carefully arranged chain of middlewares
that can:

- show developer friendly information about an error
- show a generic fallback (`Something went wrong`) error response

We do try really hard to make sure those middlewares don't crash,
however sometimes they do. Most of the time, it's not even Rails' fault.
For example the `ActionDispatch::DebugExceptions#render_exception`, as
private as it is, it's commonly freedom patched by a lot of plugins,
that need to interact with application errors, web-console included.

The API of the render_exception method has changed in the past, and it
can change in the future. This may be a common place of errors during
upgrades.

Previously, when `ActionDispatch::DebugExceptions` crashes, the default
fallback error response defined in `ActionDispatch::ShowExceptions`
kicks in. However, the internal error is not logged anywhere and this
may throw a lot of Rails developers into limbo. What is going on? Have
I done something? What's the error?

For someone unfamiliar with the stack, this is quite the mysterious
problem. We have had crashes in web-console and we have tried to tackle
them with solutions like rails/web-console#181. This is a more general
solution that can benefit all the plugins relying on overriding
`#render_exception`.

Now, when the plugins or `ActionDispatch::DebugExceptions` itself
crashes, we will try very hard to log the internal error to the logs
itself or the `stderr` if none of the standard logs have been
initialized when the crash occurred.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants