Film Finder Step 16 - getGenres function break

Link for the project

Everything went smooth with the creation of the getGenres function, but as soon as I finished the first portion of the getMovies function, as I try to log the JSON Response, nothing shows up. Plus, the drop down menu no longer is populated with the genres… I reviewed it and watched the walkthrough video multiples times.

My code so far:

const tmdbKey = 'My Key';
const tmdbBaseUrl = 'https://api.themoviedb.org/3';
const playBtn = document.getElementById('playBtn');

const getGenres = async () => {
  const genreRequestEndpoint = '/genre/movie/list';
  const requestParams = `?api_key=${tmdbKey}`;
  const urlToFetch = `${tmdbBaseUrl}${genreRequestEndpoint}${requestParams}`;
  try {
    const response = await fetch(urlToFetch);
    if (response.ok) {
      const jsonResponse = await response.json();
      const genres = jsonResponse.genres;
      return genres;
    }
  } catch (error) {
    console.log(error);
  }
};

const getMovies = async () => {
  const selectedGenre = getSelectedGenre();
  const discoverMovieEndpoint = '/discover/movie';
  const requestParams = `?api_key=${tmdbKey}&with_genres=${selectedGenre}`;
  const urlToFetch    = `${tmdbBaseUrl}${discoverMovieEndpoint}${requestParams}`;

  try {
      const response = await fetch(urlToFetch);
    if (response.ok) {
      const jsonResponse = await response.json();
      console.log(jsonResponse);
    } catch (error) {
      console.log(error);
    };
  };
};
getMovies();
 
const getMovieInfo = () => { };

// Gets a list of movies and ultimately displays the info of a random movie from the list
const showRandomMovie = () => {
  const movieInfo = document.getElementById('movieInfo');
  if (movieInfo.childNodes.length > 0) {
    clearCurrentMovie();
  };

};

getGenres().then(populateGenreDropdown);
playBtn.onclick = showRandomMovie;```

Thanks!

In the getMovies function, you seem to have the catch block inside the try block.
That should not be the case.
The catch block should be after the try block.

It worked! Thank you