From 926636c331b206e85139179fd10607ff108ebc1a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Mar 2021 23:39:28 +0100 Subject: [PATCH] web: fix error handling in forms for non-server errors Signed-off-by: Jens Langhammer --- web/src/elements/forms/Form.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/elements/forms/Form.ts b/web/src/elements/forms/Form.ts index fd12a6785..6a7c84282 100644 --- a/web/src/elements/forms/Form.ts +++ b/web/src/elements/forms/Form.ts @@ -59,8 +59,11 @@ export class Form extends LitElement { return ex.json(); } return ex; - }).then((errorMessage: ErrorResponse) => { + }).then((errorMessage: ErrorResponse | Error) => { if (!errorMessage) return errorMessage; + if (errorMessage instanceof Error) { + throw errorMessage; + } const elements: PaperInputElement[] = ironForm._getSubmittableElements(); elements.forEach((element) => { const elementName = element.name;