Skip to content

Commit 0380399

Browse files
TylerBarnesgatsbybot
and
gatsbybot
authored
feat(gatsby-source-filesystem): improve wrong url rejection message (#25965)
* feat(gatsby-source-filesystem: improve wrong url rejection message The existing message made tracing down a bug from within the new WP source plugin harder than necessary. Old message: `wrong url: ${url}` Updated message: `url passed to createRemoteFileNode is either missing or not a proper web uri: ${url}` * chore: format * update rejects test to match new message Co-authored-by: gatsbybot <[email protected]>
1 parent 29a875c commit 0380399

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/gatsby-source-filesystem/src/__tests__/create-remote-file-node.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ describe(`create-remote-file-node`, () => {
7676
url: ``,
7777
})
7878

79-
expect(value).rejects.toMatch(`wrong url: `)
79+
expect(value).rejects.toMatch(
80+
`url passed to createRemoteFileNode is either missing or not a proper web uri: `
81+
)
8082
})
8183

8284
it(`does not increment progress bar total`, () => {
@@ -85,7 +87,9 @@ describe(`create-remote-file-node`, () => {
8587
url: ``,
8688
})
8789

88-
expect(value).rejects.toMatch(`wrong url: `)
90+
expect(value).rejects.toMatch(
91+
`url passed to createRemoteFileNode is either missing or not a proper web uri: `
92+
)
8993

9094
expect(progressBar.total).toBe(0)
9195
expect(progressBar.tick).not.toHaveBeenCalled()

packages/gatsby-source-filesystem/src/create-remote-file-node.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,9 @@ module.exports = ({
362362
}
363363

364364
if (!url || isWebUri(url) === undefined) {
365-
return Promise.reject(`wrong url: ${url}`)
365+
return Promise.reject(
366+
`url passed to createRemoteFileNode is either missing or not a proper web uri: ${url}`
367+
)
366368
}
367369

368370
if (totalJobs === 0) {

0 commit comments

Comments
 (0)