aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
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
commite9a8f3c8722a306b16febcc4650e6d5df7336411 (patch)
treef7ab5a283b4c91a978d52ac611d92d49f99fcc57 /src/lib/utils.js
parent92b362d4335b428f600b5eab5a26c0f215f4dd69 (diff)
downloadcoinos-ui-e9a8f3c8722a306b16febcc4650e6d5df7336411.tar.gz
coinos-ui-e9a8f3c8722a306b16febcc4650e6d5df7336411.zip
handle pin for generate
Diffstat (limited to 'src/lib/utils.js')
-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) => {