aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-06 10:13:27 -0800
committerAdam Soltys <[email protected]>2023-01-06 10:13:27 -0800
commite398ccf8b21e38c5fd0bc445acce4d6542551713 (patch)
treef7ab5a283b4c91a978d52ac611d92d49f99fcc57 /src/lib
parentafba8e9f74efc33d27b4c4ea751f1c35afb52ada (diff)
downloadcoinos-ui-e398ccf8b21e38c5fd0bc445acce4d6542551713.tar.gz
coinos-ui-e398ccf8b21e38c5fd0bc445acce4d6542551713.zip
handle pin for generate
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 25b331ed..d7fba2fc 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -46,11 +46,12 @@ export const post = (url, body, headers) => {
if (r.ok) return r.text();
let text = await r.text();
+ let message;
try {
- let { message } = JSON.parse(text);
- if (message) throw new Error(message);
+ ({ message } = JSON.parse(text));
} catch (e) {}
+ if (message) throw new Error(message);
throw new Error(text);
})
.then((body) => {