Skip to content

Commit

Permalink
catch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBarnes committed Jan 16, 2023
1 parent 3b6e33e commit 9459d4e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/gatsby/src/services/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,15 @@ export async function initialize({
}
}

const initialWebhookBody: WebhookBody = process.env
.GATSBY_INITIAL_WEBHOOK_BODY
? JSON.parse(process.env.GATSBY_INITIAL_WEBHOOK_BODY)
: undefined
let initialWebhookBody: WebhookBody = undefined

if (process.env.GATSBY_INITIAL_WEBHOOK_BODY) {
try {
initialWebhookBody = JSON.parse(process.env.GATSBY_INITIAL_WEBHOOK_BODY)
} catch (e) {
reporter.error(`Failed to parse GATSBY_INITIAL_WEBHOOK_BODY as JSON`)
}
}

return {
store,
Expand Down

0 comments on commit 9459d4e

Please sign in to comment.