Session 19: Sports design overhaul — player cards with headshots, game card redesign, scan page tonight's players, odds diagnostic logging, tier gate utility (1444 tests)
This commit is contained in:
@@ -300,7 +300,20 @@ async function getOdds(sport) {
|
||||
};
|
||||
}
|
||||
|
||||
// No cache at all
|
||||
// No cache at all. Session 19 — surface the underlying cause in
|
||||
// logs so operators can tell odds-api auth failures apart from
|
||||
// network blips apart from rate-limit responses. The 503 wrapper
|
||||
// hides everything by design (don't leak details to clients);
|
||||
// this log gives the operator the signal they need.
|
||||
const upstreamStatus = err.response && err.response.status;
|
||||
const upstreamBody = err.response && err.response.data;
|
||||
console.error(
|
||||
`[oddsService] ${sport} fetch failed — no cache fallback. ` +
|
||||
`upstream_status=${upstreamStatus || 'n/a'} ` +
|
||||
`code=${err.code || 'n/a'} ` +
|
||||
`message=${err.message} ` +
|
||||
`upstream_body=${upstreamBody ? JSON.stringify(upstreamBody).slice(0, 200) : 'n/a'}`,
|
||||
);
|
||||
if (err.statusCode === 429) throw err;
|
||||
const serviceError = new Error('Odds service unavailable.');
|
||||
serviceError.statusCode = 503;
|
||||
|
||||
Reference in New Issue
Block a user