web: a form's own failure wording shows for an unknown error; drop the unused audio loader seam (#8300)
release / go (push) Successful in 1m41s
release / integration (push) Successful in 2m21s
release / web (push) Successful in 1m1s
release / govulncheck (push) Successful in 18s
release / android (push) Successful in 5m13s
release / Build signed APK (push) Successful in 7m0s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 37s
release / Verify release artifacts (tag releases only) (push) Skipped

errMessage took a fallback but looked codes up with copyForCode, which never
returns nothing, so a settings card's "Couldn't save proxy depth." was
never seen: an unknown code read "Something went wrong." It now uses
knownCopy, as the register page already did, and copyForCode is gone.

audioLoader let a desktop shell swap the stream URL for its own cache. No
such shell exists and nothing called setAudioLoader, so the player reads
the track's stream_url directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 17:14:09 -05:00
co-authored by Claude Opus 5.5
parent 877bb7e9c4
commit e11e2f1649
6 changed files with 16 additions and 106 deletions
+6 -5
View File
@@ -1,4 +1,4 @@
import { copyForCode } from './error-copy';
import { knownCopy } from './error-copy';
import detailCodesJson from '../styles/error-detail-codes.json';
/**
@@ -23,14 +23,15 @@ export function errCode(err: unknown): string {
const DETAIL_CODES: ReadonlySet<string> = new Set(detailCodesJson);
/**
* Returns user-facing copy for an unknown error value. Looks up the
* error's code in the error-copy map; falls back to the supplied
* fallback (default: "Something went wrong.") when the code is unknown.
* Returns user-facing copy for an unknown error value: the copy for its
* code when the code is known, and otherwise the caller's own wording,
* such as a form's "Couldn't save the public address." (default:
* "Something went wrong.").
* For a DETAIL_CODES code, the server's message is appended.
*/
export function errMessage(err: unknown, fallback = 'Something went wrong.'): string {
const code = errCode(err);
const copy = copyForCode(code) ?? fallback;
const copy = knownCopy(code) ?? fallback;
if (!DETAIL_CODES.has(code)) return copy;
const detail = (err as { message?: unknown })?.message;
return typeof detail === 'string' && detail.trim() !== '' ? `${copy} ${detail}` : copy;