Skip to content

Commit 8d4cf22

Browse files
committed
don't show error popup on reverse geocode failure
This error consistently shows up in the simulator due to SSL not being set up. It could also happen if the API is down or inaccessible for any reason. I don't want to silence this error altogether, but since it is not a critical failure, I am just going to make it a toast instead of an intrustive popup
1 parent e5d4c1e commit 8d4cf22

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

www/js/diary/useAddressNames.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Bottleneck from 'bottleneck';
2-
import { displayError, logDebug } from '../plugin/logger';
2+
import { logDebug, logWarn } from '../plugin/logger';
33
import {
44
CompositeTrip,
55
ConfirmedPlace,
@@ -10,6 +10,7 @@ import {
1010
import { Point } from 'geojson';
1111
import { useEffect, useState } from 'react';
1212
import { NominatimResponse } from '../types/apiTypes';
13+
import { AlertManager } from '../components/AlertBar';
1314

1415
const GEOCODING_API_URL = 'https://nominatim.openstreetmap.org';
1516
const nominatimLimiter = new Bottleneck({ maxConcurrent: 2, minTime: 500 });
@@ -68,7 +69,9 @@ async function fetchNominatim(loc_geojson: Point): Promise<NominatimResponse | u
6869
} catch (error) {
6970
if (!nominatimError) {
7071
nominatimError = error;
71-
displayError(error, 'while reading address data');
72+
const msg = `Error fetching location name\n${nominatimError}`;
73+
logWarn(msg);
74+
AlertManager.addMessage({ text: msg });
7275
}
7376
}
7477
}

0 commit comments

Comments
 (0)