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