Report errors instead of swallowing them - #4
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
Errors were only logged when run_console was enabled and AJAX failures other than 400/404 were dropped. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Every one of the 88
try/catchblocks inJS/GF-1.jsonly logged whenrun_consolewastrue— the default isfalse, so in production every thrown error disappeared with no trace and the function silently returnedundefined. AJAX failures were worse: only400/404reached the caller's callback, so500,403, redirects, DNS/connection errors and timeouts left the callback never invoked at all.All catches now go through one reporter that always surfaces the error and can be routed to the host app:
XHR (
_requestGET/_requestPUT/_requestPOST/_requestDELETE/_loadDoc) now propagates every failure exactly once, guarded by a per-request_settledflag so the callback can't fire twice:Also fixed / tightened:
_requestDELETEdeclaredconst ___rpinsidetry, so its owncatchthrewReferenceError: ___rp is not definedwhile reporting an error — nowvar.203("request denied") response used to be dropped silently; it is reported and forwarded to the callback._getLocation's geolocation error handler (permission denied, timeout, ...) did nothing unlessrun_consolewas on._importhad noscr.onerror: a script that failed to load never called back — now reports and callsfu(false)._checkInternet(st)threw on a missing argument (st.url) and reported disconnection through_writeLog; guardsstand reports through_reportError.README.mddocuments_setErrorHandlerand the AJAX failure contract.Testing
No test suite in the repo. Verified with
node --checkand a jsdom harness: DOM/cookie/storage/validation helpers behave as before, a forced throw reaches bothconsole.errorand a custom handler, and against a local HTTP server_requestGETnow yields500and0(connection refused) to the callback where it previously yielded nothing.Link to Devin session: https://app.devin.ai/sessions/1cf7098921c149a780cc76a11ec7ba1c
Requested by: @lamhotsimamora