Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

106
Visualizações
How can i catch the error when the api reaches its daily limit in JS?

I am trying to catch the specific error when a certain API key expires or it reaches its daily response limit(assuming 1000 per day).

const moviesearchEngine=()=>{
    let searchBox = document.querySelector('.searchBox');
    let movieTitle = document.querySelector('.movieTitle');
    let yearofRelease = document.querySelector('.yearofRelease');
    let genre = document.querySelector('.genre');
    let director = document.querySelector('.director');
    let plot = document.querySelector('.plot');

    const apiCall = ()=>{
        let params = new URLSearchParams({
            t:searchBox.value,
            apikey:`key`
        })
        let api = `http://www.omdbapi.com/?${params}`;

        //fetching the api orelse showing the error
        fetch(api).then((response)=>{
                return response.json();
        }).then((data)=>{
            //assigning the data to variable
            console.log(data)
        })
    }
    apiCall();
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should try to read json response as it has different key and from one of them you can find the one who is responsible for setting limit. It is your api id key.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda