From d5e12043d8619ffeed6eb46b5a7cb5d7c1b724d9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 4 Oct 2023 06:37:46 +0000 Subject: catch shopify errors --- routes/shopify.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/routes/shopify.js b/routes/shopify.js index ddb290df..aaecbed0 100644 --- a/routes/shopify.js +++ b/routes/shopify.js @@ -17,24 +17,24 @@ export default async ({ body: { hash }, params: { id } }, res) => { let user = await g(`user:${p.uid}`); try { - let r = await got - .post( - `https://${user.shopifyStore}.myshopify.com/admin/api/2023-07/graphql.json`, - { - headers: { - "Content-Type": "application/json", - "X-Shopify-Access-Token": user.shopifyToken - }, - json: { - query, - variables: { input: { id: `gid://shopify/Order/${id}` } } + let r = await got + .post( + `https://${user.shopifyStore}.myshopify.com/admin/api/2023-07/graphql.json`, + { + headers: { + "Content-Type": "application/json", + "X-Shopify-Access-Token": user.shopifyToken, + }, + json: { + query, + variables: { input: { id: `gid://shopify/Order/${id}` } }, + }, } - } - ) - .json(); - } catch(e) { - err("problem marking shopify order as paid", e.message); - } + ) + .json(); - res.send(r); + res.send(r); + } catch (e) { + err("problem marking shopify order as paid", e.message); + } }; -- cgit v1.2.3