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

Add source snippet to exception stack trace for easier debugging #4880

Open
Bananeweizen opened this issue Jan 10, 2025 · 0 comments
Open

Add source snippet to exception stack trace for easier debugging #4880

Bananeweizen opened this issue Jan 10, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@Bananeweizen
Copy link
Contributor

What problem are you trying to solve?

When a recipe throws an exception, only the file name of the source file is shown. Quite often that makes guessing the affected source snippet basically impossible, at least that's my experience from previous bug reports. Therefore adding either a short source snippet or the position in the file (line and row, or offset) would really help debugging recipe exceptions.

Describe the solution you'd like

In a prototype, I just added cursor.toString() to the log output that prints the exception stack trace. While that produced far too much output, it helped me identify the relevant source code in many cases, as this produces a kind of "nested snippets" with the uppermost being the relevant piece.

You surely have better ideas how to do that.

Are you interested in contributing this feature to OpenRewrite?

You probably can do that better than me.

@Bananeweizen Bananeweizen added the enhancement New feature or request label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant