diff options
| author | Adam Soltys <[email protected]> | 2023-01-06 10:13:27 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-06 10:13:27 -0800 |
| commit | e398ccf8b21e38c5fd0bc445acce4d6542551713 (patch) | |
| tree | f7ab5a283b4c91a978d52ac611d92d49f99fcc57 /src/lib/utils.js | |
| parent | afba8e9f74efc33d27b4c4ea751f1c35afb52ada (diff) | |
| download | coinos-ui-e398ccf8b21e38c5fd0bc445acce4d6542551713.tar.gz coinos-ui-e398ccf8b21e38c5fd0bc445acce4d6542551713.zip | |
handle pin for generate
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 5 |
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) => { |
