add feature 'location' that can locate where the Error throw in project file and not affect origin api #422
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.
While developing a web application, I discovered the anyhow project, which significantly streamlined my development process and brought me great joy. However, I noticed that when generating error messages, the first stack unwinding operation incurs substantial performance overhead. Additionally, sifting through dozens of stack frames to locate the error source proved cumbersome.
This led me to explore alternatives for capturing error contexts and original throw locations without stack unwinding. I found a library called
anyhow_ext
that extends functionality by recording error locations, though it requires adding .dot() markers at relevant points.I then considered: Could this be implemented as a native feature in anyhow? With AI assistance, I developed a solution that:
🛠️ Integrates error location tracking
⚡ Eliminates performance bottlenecks
✅ Maintains full backward compatibility
📚 Includes comprehensive test cases and documentation
I am excited to share this contribution and hope you and the community find it valuable!
appreciate.