Street Level: a geocoder that throws fails show_street_level at its location stage

A provider that threw while geocoding (offline, an upstream down) escaped
the action as a bare error. show_street_level now reports it as its
location stage ("Could not arrive at …", the cause in detail), and nothing
is switched or looked up; fly_to_location itself is unchanged.
This commit is contained in:
German Khokhlov committed 2026-11-11 13:46:10 +04:00
1 parent 8334262109
commit a8970c1f18
2 files changed
+41 -13

No files matched your search

+22 -13
View File
@@ -3961,19 +3961,28 @@ async function requestStreetLevel(
if (atViewCentre || (args.fly === false && hasCoordinates)) {
if (hasCoordinates) point = { lat: latitude, lon: longitude };
} else {
location = await runGevAction(
'fly_to_location',
{
...(entity
? { entity }
: hasCoordinates
? { latitude, longitude }
: { query }),
viewMode: 'close',
waitForArrival: true,
},
runOptions,
);
try {
location = await runGevAction(
'fly_to_location',
{
...(entity
? { entity }
: hasCoordinates
? { latitude, longitude }
: { query }),
viewMode: 'close',
waitForArrival: true,
},
runOptions,
);
} catch (error) {
// A geocoder that throws (offline, a provider down) is this stage's
// failure too, not an error past the action.
return fail('location', `Could not arrive at ${label}`, {
cancelled: !current(),
detail: String(error?.message || error),
});
}
if (location?.ok !== true || !current())
return fail(
'location',
+19
View File
@@ -7005,6 +7005,25 @@ test('show_street_level tells a failed enable, a delisted source, a key refused
assert.deepEqual(unconfigured.order, [], 'nothing changed');
});
test('show_street_level reports a geocoder that throws as its location stage', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const h = createStreetLevelHarness({ enabled: true, activeStack: 'osm' });
const runner = createGevActionRunner({
viewer: createVoiceNavigationHarness().viewer,
styleManager: { mapStackController: { getActiveId: () => 'osm' }, setMapStack: async () => ({ ok: true }) },
dataManager: h.dataManager,
placeSearch: {
geocode: async () => {
throw new Error('geocoder unreachable');
},
},
});
const result = await runner('show_street_level', { query: 'Capitol Mall', provider: 'mapillary' });
assert.deepEqual([result.ok, result.stage], [false, 'location']);
assert.equal(result.error, 'Could not arrive at Capitol Mall');
assert.deepEqual(h.order.filter((step) => /^(params|open|arm)/.test(step)), [], 'nothing switched or looked up');
});
test('show_street_level reports a flight that lands without a position', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const hit = createStreetLevelHarness({ enabled: true, activeStack: 'osm' });