Skip to content

Commit

Permalink
fix: try/catch for errors during createRemoteFileNode process (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Steele authored and ynnoj committed Jul 23, 2020
1 parent aca40f9 commit 120864c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions gatsby-source-graphcms/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ exports.onCreateNode = async (
node.remoteTypeName === 'Asset' &&
node.mimeType.includes('image/')
) {
const fileNode = await createRemoteFileNode({
url: node.url,
parentNodeId: node.id,
createNode,
createNodeId,
getCache,
})

if (fileNode) node.localFile = fileNode.id
try {
const fileNode = await createRemoteFileNode({
url: node.url,
parentNodeId: node.id,
createNode,
createNodeId,
getCache,
})

if (fileNode) node.localFile = fileNode.id
} catch (e) {
console.error('gatsby-source-graphcms:', e)
}
}
}

Expand Down

0 comments on commit 120864c

Please sign in to comment.