Skip to content

Commit

Permalink
Some error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
arnasbr committed May 7, 2024
1 parent b6aa996 commit 9f5c477
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,20 @@ export function setThresholdsForScenarios (options) {
}
}

function getLocation (location, locationsMap) {
const coordinates = locationsMap.get(location)
if (coordinates === undefined) {
throw new Error(`Location "${location}" doesn't exist.`)
}
return coordinates
}

export function getLocationCoordinates (location) {
return locations.get(location)
return getLocation(location, locations)
}

export function getProtoLocationCoordinates (location) {
return protoLocations.get(location)
return getLocation(location, protoLocations)
}

function parseLocations (filePath) {
Expand Down

0 comments on commit 9f5c477

Please sign in to comment.