From b7883de47e05d0b52ea4e04440f4894a0a9032a1 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Sun, 19 Dec 2021 02:38:15 +0100 Subject: server error messages improvement --- src_js/common.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src_js') diff --git a/src_js/common.js b/src_js/common.js index bf1327a..1928624 100644 --- a/src_js/common.js +++ b/src_js/common.js @@ -26,6 +26,8 @@ export async function calculate() { headers: {'Content-Type': 'application/json'}, body: JSON.stringify(params) }); + if (!res.ok) + throw await res.text(); const result = await res.json(); r.change(u.pipe( u.set('result', result), @@ -50,6 +52,8 @@ export async function generateOutput() { headers: {'Content-Type': 'application/json'}, body: JSON.stringify(result) }); + if (!res.ok) + throw await res.text(); const blob = await res.blob(); FileSaver.saveAs(blob, 'output.pdf'); } catch (e) { -- cgit v1.2.3-70-g09d2