Repository navigation
Fix: report Books, Now Playing and Backup failures in the widget's own words - #10
Merged
Merged
Conversation
…n words These three reported failures with a plain Error, which api-error.js replaces with "Something went wrong." on the way out. So "Audiobookshelf URL and API key required" and "Authentication failed, check password" never reached anyone. They use ctx.fail now, with a kind on each. The Backup helpers took a bare fetchJSON and had no way to reach ctx, so they take ctx itself. Backup swallowed two upstream failures with an empty catch. One unreachable instance still leaves its own slots null rather than failing the whole widget, but the reason is logged now instead of discarded. Navidrome no longer interpolates the upstream error text into the message it vouches for; a vouched message may carry only words this repo chose.
3 of 4 tasks
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
throw new Error(...)inui/widgets/{books,nowplaying,backup}/data.jswithctx.fail(message, { kind }). A plainErroris sanitised to a generic message byapi/src/api-error.js, so 29 written-for-the-user sentences were being discarded.ctxthrough the Backup helper chain (dupLogin,dupRefresh,dupGetToken,dupFetch,kopiaFetch,duplicatiJobs,kopiaSources,slots) in place of the barefetchJSON, since none of them could reachctx.failbefore.catch {}blocks inbackup/data.jswithctx.log.warn. Behaviour is unchanged — one unreachable instance still leaves its own slotsnullrather than failing the widget — but the reason is no longer discarded.api/test/widget-error.test.jsasserting no widget reports a user-facing failure with a plainError.connectionsis exempt, with the reason recorded: it catches its own throws and surfaces them as a per-serviceerrorfield inside a successful result, which the convention allows.ctx.log.*calls before the existing raw-caught-message scan, so logging a caught error is not mistaken for sending it to the browser.Testing
All green. Added 1 guard test and updated
backup-data.test.js, whose fakectxnow providesfail,KINDandloglike the real one. Mutation-checked by reverting one call to a plain throw.Checklist