gade-raghav/Weather-API

Incorrect Input returns last successful output

Closed this issue · 1 comments

Incorrect Input returns last successful output.

Command:
http://localhost:8080/weather/current?location=Mumbai

Output:
{"lat":19.0,"lon":72.0,"temp":303.0,"pressure":1010.0,"humidity":70.0,"speed":1.0,"deg":160.0,"country":"IN","city":"Mumbai","sunrise":1586998219,"sunset":1587043557}

Subsequent Command :
http://localhost:8080/weather/current?location=xyz

Output on Browser :
{"lat":19.0,"lon":72.0,"temp":303.0,"pressure":1010.0,"humidity":70.0,"speed":1.0,"deg":160.0,"country":"IN","city":"Mumbai","sunrise":1586998219,"sunset":1587043557}

Output on Console :
Error: java.io.FileNotFoundException: http://api.openweathermap.org/data/2.5/weather?q=xyz&appid=<API TOKEN>

Expected Response:
If input is incorrect, display helpful error message and handle any exceptions on the backend.

Issue has been resolved. Thank you for bringing this to our notice. Hum aapke aabhari hain.
In case of invalid input error message is displayed in the background and all the output parameters are initialized to zero with city and country parameter saying "Not found".