January 2018
Beginner
658 pages
13h 10m
English
As you remember, inside the geocode file, there were some things we needed to do. We've already handled the error related to server connection, but there is still another error pending, that is, if the body.status property equals ZERO_RESULTS. We want to print an error message in that case.
To do this, we'll inside app-promise, create our very own error. We'll throw an error inside the axios.get function. This error will cause all of the code after it, not to run. It will move right into the error handler.
Now we only want to throw an error if the status property is set to ZERO_RESULTS. We'll add an if statement at the very top of the get function to check if (response.data.status) equals ZERO_RESULTS ...
Read now
Unlock full access