Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
¿Cómo detener la ejecución del código de proceso javascript después de un error de captura?

tengo este codigo

 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); }

Este código usa try catch , en realidad se detectó el error de devolución con respecto al invalid value . pero el proceso del código aún continúa hasta update function

¿Cómo arreglo eso? para que el proceso del código se detenga después de recibir el error detectado

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!