aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-09-26 17:36:41 +0000
committerAdam Soltys <[email protected]>2023-09-26 17:36:47 +0000
commite2c633647813e1eeeebf4e601324639547cb4d2e (patch)
tree0ecfe1525f8f6efc7fa8c91e82b04b57284b17f5
parentb63116cf713acd14fa966fe3aad8772d8cb8051f (diff)
downloadcoinos-server-e2c633647813e1eeeebf4e601324639547cb4d2e.tar.gz
coinos-server-e2c633647813e1eeeebf4e601324639547cb4d2e.zip
catch shopify errors
-rw-r--r--routes/shopify.js5
1 files changed, 5 insertions, 0 deletions
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);
};