From b5f533a54b39dc8052e72505e5c730920907f554 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 23:54:07 +0100 Subject: [PATCH] Add custom error --- .../date-range-cell/date-range-cell.component.ts | 1 - src/app/helper/token.interceptor.ts | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts index e88f119..273570d 100644 --- a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts +++ b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.ts @@ -77,7 +77,6 @@ export class DateRangeCellComponent implements OnInit { } setRangeError(error: boolean): void { - console.log("error", error) this.validityChange.emit(!error); if (error) { this.dateRangeGroup.controls['from'].setErrors({ rangeError: true }); diff --git a/src/app/helper/token.interceptor.ts b/src/app/helper/token.interceptor.ts index 1778d6e..dc10b4f 100644 --- a/src/app/helper/token.interceptor.ts +++ b/src/app/helper/token.interceptor.ts @@ -65,6 +65,9 @@ export class TokenInterceptor implements HttpInterceptor { } private serverErrorMessageGenerator (error: HttpErrorResponse): string { + if (error.error?.errors[0]?.message?.includes("not provided")) { + return "Nicht alle benötigten Felder wurden ausgefüllt."; + } if (error.error.message === undefined){ return "Viele Fehler sind aufgetreten." // If you change this you have to change it over this aswell } else {