Current state
io/itunes/fetchItunesItems.ts maps API results through Promise.all with per-item null-return handling for validation failures. However, an unexpected throw anywhere inside the mapper body — for example from a failed image transform or schema utility — propagates out of Promise.all, rejects the entire array, and skips the cache.set call. All valid results for all other items in the response are silently discarded, and the cache is left empty for that build.
Ideal state
- Each mapper body is wrapped in
try/catch that returns null on unexpected errors, matching the explicit null-return handling already used for validation failures
- A single unexpected error for one iTunes item does not cause
Promise.all to reject and discard results for all other items
- The cache is populated with whatever valid results exist even when one item's processing throws
Out of scope
- Changing the outer try/catch, error reporting structure, or validation logic
Starting points
io/itunes/fetchItunesItems.ts lines 97–145 — the Promise.all mapper body where per-item errors need a try/catch fallback
QA plan
- Open
io/itunes/fetchItunesItems.ts lines 97–145 — confirm the mapper handles explicit validation failures with return null but does not try/catch unexpected throws within the body
- After the fix: confirm each iteration of the
Promise.all map is wrapped in try/catch that returns null on unexpected errors
- In a local build, mock one iTunes result to throw an unexpected error inside the mapper — expect the remaining items are returned and
cache.set is called with the valid subset
Done when
An unexpected throw inside the fetchItunesItems Promise.all mapper causes that item to yield null rather than rejecting the entire Promise.all and discarding all other results.
Current state
io/itunes/fetchItunesItems.tsmaps API results throughPromise.allwith per-item null-return handling for validation failures. However, an unexpected throw anywhere inside the mapper body — for example from a failed image transform or schema utility — propagates out ofPromise.all, rejects the entire array, and skips thecache.setcall. All valid results for all other items in the response are silently discarded, and the cache is left empty for that build.Ideal state
try/catchthat returnsnullon unexpected errors, matching the explicit null-return handling already used for validation failuresPromise.allto reject and discard results for all other itemsOut of scope
Starting points
io/itunes/fetchItunesItems.tslines 97–145 — thePromise.allmapper body where per-item errors need atry/catchfallbackQA plan
io/itunes/fetchItunesItems.tslines 97–145 — confirm the mapper handles explicit validation failures withreturn nullbut does nottry/catchunexpected throws within the bodyPromise.allmap is wrapped intry/catchthat returnsnullon unexpected errorscache.setis called with the valid subsetDone when
An unexpected throw inside the
fetchItunesItemsPromise.all mapper causes that item to yieldnullrather than rejecting the entire Promise.all and discarding all other results.