March 2018
Intermediate to advanced
592 pages
13h 44m
English
Step one is to actually print the error out to the screen so we can see what we're working with. We're going to catch the error and we're going to print the error, console.log(e):
convertCurrencyAlt('USD', 'CAD', 100).then((status) => {
console.log(status);
}).catch((e) => {
console.log(e);
});
Now let's go ahead and start making some things fail. We're going to kick things off by making getCountries fail; that's the first call.
Now, this one only uses to, so all we have to do to get that to fail is to send in a bad to countryCode. I'm going to use MMM:
convertCurrencyAlt('USD', 'MMM', 100).then((status) => {
console.log(status);
}).catch((e) => {
console.log(e);
});
Save the file and we'll see what we get ...