fix: Errors from asynchronous API calls have incomplete stack traces#719
Open
ThomasGreiner wants to merge 1 commit intomozilla:masterfrom
Open
fix: Errors from asynchronous API calls have incomplete stack traces#719ThomasGreiner wants to merge 1 commit intomozilla:masterfrom
ThomasGreiner wants to merge 1 commit intomozilla:masterfrom
Conversation
|
Hey, can we please merge these changes? 🙏 FYI: The CI failed for a different reason, unrelated to code changes. |
Member
|
@ThomasGreiner would you mind to rebase this PR? we fixed the unrelated issue hit by the CI job as part of #722 and we just merged that. |
f8ab5b7 to
d31fc60
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #719 +/- ##
==========================================
+ Coverage 90.71% 90.84% +0.13%
==========================================
Files 1 1
Lines 140 142 +2
==========================================
+ Hits 127 129 +2
Misses 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
@rpl Sure thing, done. Thanks for helping fix the CI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We've been observing various browser errors in the Adblock Plus extension that the browser exposes via
browser.runtime.lastError. Unfortunately, the stack traces of those errors terminate at webextension-polyfill (in its callback function that handlesbrowser.runtime.lastError) and therefore don't provide any further information to the extension about which of its API calls led to the error.e.g.
browser.action.setBadgeText({tabId: 123, text: ""})This pull request contains the following changes to provide a more useful/complete stack trace for such browser errors:
Error message is based on MDN's description of
browser.runtime.lastError.browser.runtime.lastErroras message to the new error object.Since the
Errors "cause" property isn't widely supported yet, overwriting the error's "message" property seems to be next-best approach in order to avoid merging stack traces, as that can get messy. That being said, I acknowledge that this is merely a workaround, and that any approach that allows us to natively retain the full stack trace across such asynchronous API calls should be preferable.