aboutsummaryrefslogtreecommitdiff
path: root/src_js
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2021-12-19 02:38:15 +0100
committerbozo.kopic <bozo@kopic.xyz>2021-12-19 02:38:15 +0100
commitb7883de47e05d0b52ea4e04440f4894a0a9032a1 (patch)
treefaee792c03a4bd456fb90588eee9ca24c88bee6c /src_js
parent8e8a381c57298e1caa992373d1081a64d5924de6 (diff)
server error messages improvement
Diffstat (limited to 'src_js')
-rw-r--r--src_js/common.js4
1 files changed, 4 insertions, 0 deletions
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) {