| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Current Level: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Add proper error handling to your API calls.
.catch() to handle network errors (connection issues, timeouts)if(response.ok === false) { console.log('API Error: ' + response.status + ' ' + response.statusText) } to handle API errors (404, 500, etc.)https:// to thtps:// (typo in protocol)&latitude=500 (There is not latitude 500, latitude goes from -90 to 90.)/v1/forecast to /v1/forecst (missing ‘a’)Need help with error handling? Check out these snippets:
.catch() examplessetText() to show error messages to users| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Current Level: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |