0
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");
  }
});

It prints :

"Error is not defined"

instead of

"Unable to find that address". xyz gets printed.

1
  • Change ERROR to Error. Commented Apr 15, 2018 at 13:54

2 Answers 2

0

Here you have done a syntactical error i.e. ERROR should not be written in UpperCase it should be like Error. That's why it is not recognizing the Error keyword.

So the correction is in this line:

throw new Error('Unable To Find That Address');
Sign up to request clarification or add additional context in comments.

Comments

-1

You must not have made jQuery available to your script.

Add this to the top of your file:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

1 Comment

Seriously, what does this have to do with the OP problem. It's clearly tagged in node.js and even if it wasn't what does jQuery have to do with: Error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.