From 1954d00e4f7776c02856bd84d4cc8ca9c90afc72 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Sat, 16 Apr 2022 23:26:39 +1000 Subject: [PATCH] Added error handling for empty callsigns --- APIS_README.md | 15 ++++++++++++--- config/default.json | 2 +- config/production.json | 2 +- package.json | 2 +- server.js | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/APIS_README.md b/APIS_README.md index 13af226..6a749f0 100644 --- a/APIS_README.md +++ b/APIS_README.md @@ -25,14 +25,23 @@ Route `/flights/` #### Arivals Route `/arrivals/` -Returns `[pilot]` +Returns +- 200 `[pilot]` +- 404 +- 500 #### Callsign Route `/callsign/` -Returns `{pilot}` +Returns +- 200 `{pilot}` +- 404 +- 500 #### Departures Route `/departures/` -Returns `[pilot]` +Returns +- 200 `[pilot]` +- 404 +- 500 diff --git a/config/default.json b/config/default.json index 9dc3486..17627a5 100644 --- a/config/default.json +++ b/config/default.json @@ -1,7 +1,7 @@ { "app": { "name": "vatsim-map", - "version": "0.0.1", + "version": "0.0.3", "url": "https://github.com/vatpac-technology/vatsim-map/", "log_level": 30, "http": { diff --git a/config/production.json b/config/production.json index 9dc3486..17627a5 100644 --- a/config/production.json +++ b/config/production.json @@ -1,7 +1,7 @@ { "app": { "name": "vatsim-map", - "version": "0.0.1", + "version": "0.0.3", "url": "https://github.com/vatpac-technology/vatsim-map/", "log_level": 30, "http": { diff --git a/package.json b/package.json index a4a13c1..3dfad77 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vatsim-map", "type": "module", - "version": "0.0.1", + "version": "0.0.3", "description": "Display VATSIM traffic on a map for a given set of FIRs", "private": true, "dependencies": { diff --git a/server.js b/server.js index 8ff14c3..1a7d4ad 100644 --- a/server.js +++ b/server.js @@ -56,6 +56,8 @@ app.get('/v1/flights/callsign/:callsign', cors(), async (req, res) => { const feature = pilots.features.find(e => e.properties.pilot.callsign === req.params.callsign) if(feature == false){ res.sendStatus(500); + } else if(feature == undefined){ + res.sendStatus(404); }else{ res.send(feature.properties.pilot) }