【发布时间】:2018-04-15 13:36:51
【问题描述】:
axios.get(geocodeUrl).then((response) =>
{
if(response.data.status === 'ZERO_RESULTS')
{
throw new ERROR('Unable To Find That Address');
}
console.log(JSON.stringify(response.data, undefined ,2));
}).catch((e)=> {
if(e.code === 'ENOTFOUND')
{
console.log('Unable to contact api servers');
}
else {
console.log(e.message);
console.log("xyz");
}
});
打印出来:
"Error is not defined"
而不是
"Unable to find that address"。
xyz 被打印出来。
【问题讨论】:
-
将
ERROR更改为Error。