feat(ui): R3 S3 — surface swallowed errors
- notifyYouTubeActionError: on any non-403 error, show the server's own reason (err.detail, e.g. "Not enough quota left today") instead of the caller's generic fallback, which was discarded (U-3.2.8). 403 still offers the Connect affordance. - App boot error now offers a Retry (StateMessage) instead of a dead "Something went wrong" (U-4.2). - deletePlaylist prefers the server's reason over a blanket "couldn't delete on YouTube" that misleads when the failure wasn't the YouTube side. - Already covered in earlier sprints (verified): the live-search "Load more" already surfaces the quota error inline via err.detail, and ChannelPage subscribe/unsubscribe already route through notifyYouTubeActionError.
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
||||
Upload,
|
||||
Youtube,
|
||||
} from "lucide-react";
|
||||
import { api, type Video } from "../lib/api";
|
||||
import { api, HttpError, type Video } from "../lib/api";
|
||||
import { notify } from "../lib/notifications";
|
||||
import { notifyYouTubeActionError } from "../lib/youtubeErrors";
|
||||
import { playlistName } from "../lib/playlistName";
|
||||
@@ -489,10 +489,14 @@ export default function Playlists() {
|
||||
setSelectedId(remaining[0]?.id ?? null);
|
||||
try {
|
||||
await api.deletePlaylist(deletedId, onYoutube);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
// Prefer the server's specific reason (e.g. a local vs YouTube-side failure) over a blanket
|
||||
// "couldn't delete on YouTube" that misleads when the failure wasn't the YouTube side.
|
||||
notify({
|
||||
level: "warning",
|
||||
message: onYoutube ? t("playlists.deleteYtFailed") : t("playlists.deleteFailed"),
|
||||
message:
|
||||
(err instanceof HttpError && err.detail) ||
|
||||
(onYoutube ? t("playlists.deleteYtFailed") : t("playlists.deleteFailed")),
|
||||
});
|
||||
}
|
||||
qc.removeQueries({ queryKey: ["playlist", deletedId] });
|
||||
|
||||
Reference in New Issue
Block a user