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

302
Visualizações
stopping strapi to then run a node command does nothing. What do i have to do to find out, where the error is?

enter image description here

I have the following error :

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag \`--unhandled-rejections=strict\`
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Firstly, declare new object doesn't need await, so change your declare new user to const user = new User(your_object_here)

And what you mean in catch() then you throw error and catch again. Change you code to this and try again

try{
  // logic here
  res.send('ok')
}catch(error) {
  console.log('that did not go well');
  res.status(500).send('fail')
}
about 4 years ago · Juan Pablo Isaza Relatório

0

This error happens because you are trying to throw an error inside a catch bloc. (documentation)

If you really need to throw an error you must put another try / catch inside your catch block. But you should consider removing the throw and only print the error inside the catch and send a 500 error .

try {
  await user.save()
  res.send("ok");
} catch (Error e) {
  console.log(e);
  res.status(500).send('ko');
}
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