fix(cctv): point a rejected Ontario key at ONTARIO_511_API_KEY; README notes the key

A wrong or revoked key logged only "download failed: 400"; a 400, 401 or
403 now adds "(check ONTARIO_511_API_KEY)". The README's CCTV row listed
Ontario among the default cameras with no mention of the key it now
needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
quanticsoul4772andClaude Opus 5.5 committed 2026-10-18 16:43:15 -07:00
1 parent cd0956eef7
commit 91461381ee
3 files changed
+10 -3

No files matched your search

+1 -1
View File
@@ -60,6 +60,6 @@ test('a rejected key is reported by status, never by the key itself', async (t)
{ ONTARIO_511_API_KEY: 'secret-key-value' },
);
assert.deepEqual(cameras, []);
assert.match(warnings.join('\n'), /400/);
assert.match(warnings.join('\n'), /400 \(check ONTARIO_511_API_KEY\)/);
assert.doesNotMatch(warnings.join('\n'), /secret-key-value/);
});
+8 -1
View File
@@ -539,7 +539,14 @@ export async function loadOntarioSourcesFromOpenData(
signal: AbortSignal.timeout(CCTV_SOURCE_FETCH_TIMEOUT_MS),
});
if (!resp.ok) {
console.warn('[CCTV] Ontario 511 camera download failed:', resp.status);
// The API answers 400 "Invalid Key" to a wrong or revoked key.
console.warn(
'[CCTV] Ontario 511 camera download failed:',
resp.status,
resp.status === 400 || resp.status === 401 || resp.status === 403
? '(check ONTARIO_511_API_KEY)'
: '',
);
return [];
}
const rows = await resp.json();