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

Map bindings to traces based on the trace __FILE__ and __LINE__ #203

Merged
merged 1 commit into from Jun 15, 2016

Conversation

gsamokovarov
Copy link
Collaborator

@gsamokovarov gsamokovarov commented Jun 14, 2016

Currently, we naively map exception bindings by the exception
backtrace's indexes. This doesn't work as the backtraces and the
bindings doesn't map one to one and we're most likely to be out of sync
in a couple of trace indexes.

With this change, I try to be smarter about the binding that corresponds
to an exception backtrace index. The ExceptionMapper objects tries to
map to a binding based on the FILE and LINE of the trace behind
that index. It also hides this transformation in an interface similar to
an Array, so we didn't needed to change much backend code and any
frontend code.

Right now, if you go and click through all the traces, you get the
binding right in most of the times. I can imagine we can still be off in
exceptions with custom backtraces, but we'll be off only for a couple of
bindings and not everything after those special traces.

In any case, I think this can fix a lot of the web-console doesn't work cases for Rails 5.

@gsamokovarov
Copy link
Collaborator Author

@sh19910711 do you wanna take a look?

Currently, we naively map exception bindings by the exception
backtrace's indexes. This doesn't work as the backtraces and the
bindings doesn't map one to one and we're most likely to be out of sync
in a couple of trace indexes.

With this change, I try to be smarter about the binding that corresponds
to an exception backtrace index. The `ExceptionMapper` objects tries to
map to a binding based on the __FILE__ and __LINE__ of the trace behind
that index. It also hides this transformation in an interface similar to
an `Array`, so we didn't needed to change much backend code and any
frontend code.

Right now, if you go and click through all the traces, you get the
binding in most of the times. I can imagine we can still be off in
exceptions with custom backtraces, but we'll be off only for a couple of
bindings and not everything after those special traces.

In any case, I think this can fix a lot of the `web-console doesn't
work` cases for Rails 5.
@gsamokovarov
Copy link
Collaborator Author

I'll go ahead and merge it for a swift 3.3.0 release.

@gsamokovarov gsamokovarov merged commit 783a91e into rails:master Jun 15, 2016
@gsamokovarov gsamokovarov deleted the exception-mapper branch June 15, 2016 16:55
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.

None yet

1 participant