From e398ccf8b21e38c5fd0bc445acce4d6542551713 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Jan 2023 10:13:27 -0800 Subject: handle pin for generate --- src/lib/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/utils.js') 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) => { -- cgit v1.2.3