@@ -123,7 +123,8 @@ async function pushToQueue(task, cb) {
123123 const node = await processRemoteNode ( task )
124124 return cb ( null , node )
125125 } catch ( e ) {
126- return cb ( null , e )
126+ console . warn ( `Failed to process remote content ${ task . url } ` )
127+ return cb ( e )
127128 }
128129}
129130
@@ -222,47 +223,38 @@ async function processRemoteNode({
222223 const tmpFilename = createFilePath ( pluginCacheDir , `tmp-${ digest } ` , ext )
223224
224225 // Fetch the file.
225- try {
226- const response = await requestRemoteNode ( url , headers , tmpFilename )
227- // Save the response headers for future requests.
228- await cache . set ( cacheId ( url ) , response . headers )
229-
230- // If the user did not provide an extension and we couldn't get one from remote file, try and guess one
231- if ( ext === `` ) {
232- const buffer = readChunk . sync ( tmpFilename , 0 , fileType . minimumBytes )
233- const filetype = fileType ( buffer )
234- if ( filetype ) {
235- ext = `.${ filetype . ext } `
236- }
237- }
238-
239- const filename = createFilePath (
240- path . join ( pluginCacheDir , digest ) ,
241- name ,
242- ext
243- )
244- // If the status code is 200, move the piped temp file to the real name.
245- if ( response . statusCode === 200 ) {
246- await fs . move ( tmpFilename , filename , { overwrite : true } )
247- // Else if 304, remove the empty response.
248- } else {
249- await fs . remove ( tmpFilename )
226+ const response = await requestRemoteNode ( url , headers , tmpFilename )
227+ // Save the response headers for future requests.
228+ await cache . set ( cacheId ( url ) , response . headers )
229+
230+ // If the user did not provide an extension and we couldn't get one from remote file, try and guess one
231+ if ( ext === `` ) {
232+ const buffer = readChunk . sync ( tmpFilename , 0 , fileType . minimumBytes )
233+ const filetype = fileType ( buffer )
234+ if ( filetype ) {
235+ ext = `.${ filetype . ext } `
250236 }
237+ }
251238
252- // Create the file node.
253- const fileNode = await createFileNode ( filename , createNodeId , { } )
254- fileNode . internal . description = `File "${ url } "`
255- // Override the default plugin as gatsby-source-filesystem needs to
256- // be the owner of File nodes or there'll be conflicts if any other
257- // File nodes are created through normal usages of
258- // gatsby-source-filesystem.
259- createNode ( fileNode , { name : `gatsby-source-filesystem` } )
260-
261- return fileNode
262- } catch ( err ) {
263- // ignore
239+ const filename = createFilePath ( path . join ( pluginCacheDir , digest ) , name , ext )
240+ // If the status code is 200, move the piped temp file to the real name.
241+ if ( response . statusCode === 200 ) {
242+ await fs . move ( tmpFilename , filename , { overwrite : true } )
243+ // Else if 304, remove the empty response.
244+ } else {
245+ await fs . remove ( tmpFilename )
264246 }
265- return null
247+
248+ // Create the file node.
249+ const fileNode = await createFileNode ( filename , createNodeId , { } )
250+ fileNode . internal . description = `File "${ url } "`
251+ // Override the default plugin as gatsby-source-filesystem needs to
252+ // be the owner of File nodes or there'll be conflicts if any other
253+ // File nodes are created through normal usages of
254+ // gatsby-source-filesystem.
255+ createNode ( fileNode , { name : `gatsby-source-filesystem` } )
256+
257+ return fileNode
266258}
267259
268260/**
0 commit comments