From e2c633647813e1eeeebf4e601324639547cb4d2e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Sep 2023 17:36:41 +0000 Subject: catch shopify errors --- routes/shopify.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/shopify.js b/routes/shopify.js index 0eb4dd27..ddb290df 100644 --- a/routes/shopify.js +++ b/routes/shopify.js @@ -1,5 +1,6 @@ import got from "got"; import { g } from "$lib/db"; +import { err } from "$lib/logging"; let query = `mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) { orderMarkAsPaid(input: $input) { @@ -15,6 +16,7 @@ export default async ({ body: { hash }, params: { id } }, res) => { let p = await g(`payment:${hash}`); let user = await g(`user:${p.uid}`); + try { let r = await got .post( `https://${user.shopifyStore}.myshopify.com/admin/api/2023-07/graphql.json`, @@ -30,6 +32,9 @@ export default async ({ body: { hash }, params: { id } }, res) => { } ) .json(); + } catch(e) { + err("problem marking shopify order as paid", e.message); + } res.send(r); }; -- cgit v1.2.3