Add proper error checking

This commit is contained in:
2022-06-30 18:06:11 -07:00
parent 296aecf5aa
commit ff722c754d
+4
View File
@@ -52,6 +52,10 @@ proc parseStation(station: string): string =
else: station
proc formatDepartures(etd: JSONNode): string =
if not etd["root"].hasKey("station"):
echo "No departures for this station"
return
let name = etd["root"]["station"][0]["name"].getStr
let lines = etd["root"]["station"][0]["etd"]