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

326
Visualizações
how to stop execute process code javascript after catch error?

i have this code

try {
  payload.$set.form = form.map(el => {
    let listType = ['dropdown', 'single-line', 'single-line-number', 'text', 'file'];
    let checkType = listType.includes(el.type)
    let requiredIsBool = typeof el.required == 'boolean'
    let defultIsBool = typeof el.default == 'boolean'
    let orderIsNumber = typeof el.order == 'number'

    if (!el.field_name || el.required == undefined || el.required == null || !el.order || !el.type || el.default == undefined || el.default == null || !requiredIsBool || !checkType || !orderIsNumber || !defultIsBool) {
      return this.sendInvalidResp(this.HTTP_ERROR_MESSAGES.INVALID_VALUE)
    };

    el._id = el._id || formBuilder.ObjectId()
  
    return el
  });

  let result = await formBuilder.updateForm(form_id, payload);

  return this.sendSuccessResp({ status: true, results: result });
} catch (err) {
  return this.sendErrorResp(this.HTTP_ERROR_MESSAGES.INTERNAL_ERROR);
}

This code uses try catch, actually the return error regarding invalid value has been caught. but the code process still continues until update function

how do i fix that? so that the code process stops after getting the caught error

about 4 years ago · Juan Pablo Isaza
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