Wanderlust Project

I have the problem that the url to fetch is correctly formatted and returns a good result when pasted into the browser address bar but gives a 400 Bad Request error when it runs in the program. It never gets to a response.ok of true. Also as a side note this “error” is not caught by the catch. What is going on?

const getVenues = async () => {
  const city = $input.val();
  const urlToFetch = url + city +'&'+'limit=10'+'&'+'client_id='+clientId+'&'+'client_secret='+clientSecret+'&v=20200418';
  // console.log(urlToFetch);
  try {
    const response = await fetch(urlToFetch);
    console.log(response);
    if (response.ok) {
      console.log(response);
    }
  }
  catch(error){
    console.log('Error: '+error);
  }
}

The problem seems to be happening when a service called cc-propeller.cloud is used to send the fetch request. What is this?

The catch statement is wrong. You just log error not ‘Error:+error’. Thats why your error is not being catched.