Skip to content

Commit

Permalink
fix(server): better error catching for webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
good-idea committed Apr 29, 2020
1 parent 1935ac8 commit 6da2dea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/server/src/webhooks/syncDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export const syncDocument = ({
throw new Error(`Cannot sync document of type ${type}`)
}
const storefrontId = btoa(`gid://shopify/${docType}/${id}`)
await syncUtils.syncItemByID(storefrontId).catch((err) => {
try {
await syncUtils.syncItemByID(storefrontId)
log(`synced item ${storefrontId} (/${docType}/${id})`)
} catch (err) {
log(`failed to sync item ${storefrontId} (/${docType}/${id})`)
log(err)
onError(err)
})
log(`synced item ${storefrontId}`)
}
}

0 comments on commit 6da2dea

Please sign in to comment.