Skip to content

Commit

Permalink
fix: gracefully handle areas where elevation data doesn’t exist
Browse files Browse the repository at this point in the history
  • Loading branch information
paulschreiber committed Jul 17, 2024
1 parent 7946882 commit 6dcb940
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dev-client/src/model/elevation/elevationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const getElevation = async (
const response = await fetch(
`https://epqs.nationalmap.gov/v1/json/?${queryString}`,
);
const result = await response.json();
const textResult = await response.text();
if (textResult === 'Invalid or missing input parameters.') {
return;
}
const result = JSON.parse(textResult);

elevation = parseFloat(result.value);
} catch (error) {
Expand Down

0 comments on commit 6dcb940

Please sign in to comment.