From 32e68f8827383d467d4eced3accaa6d4a2f8160b Mon Sep 17 00:00:00 2001 From: starg09 Date: Tue, 10 Oct 2023 02:17:19 -0300 Subject: [PATCH] Fix: Error ahora se muestra en pantalla para asignar cuando no se indica asignatario --- src/components/asignar/asignar.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/asignar/asignar.component.ts b/src/components/asignar/asignar.component.ts index c40ceee..82d917e 100644 --- a/src/components/asignar/asignar.component.ts +++ b/src/components/asignar/asignar.component.ts @@ -46,13 +46,21 @@ export class AsignarComponent { validarAsignacion() { if (!this.asignatario) { - throw { message: 'Debe seleccionar un usuario' } + throw new Error('Debe seleccionar un usuario') } } async asignar() { this.errors = [] - this.validarAsignacion() + try { + this.validarAsignacion() + } catch (error) { + if (error instanceof Error) { + console.error("Error validando asignaciĆ³n: " + error.message) + } + mostrarError(this, error) + return + } this.tarea.asignarA(this.asignatario) this.tareasService.actualizarTarea(this.tarea).subscribe({ next: () => { this.navegarAHome() },