Skip to content

Commit

Permalink
feat(gatsby-source-filesystem): improve wrong url rejection message (#…
Browse files Browse the repository at this point in the history
…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 <mathews.kyle+gatsbybot@gmail.com>
  • Loading branch information
2 people authored and KyleAMathews committed Jul 29, 2020
1 parent f454acd commit a4fd928
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ describe(`create-remote-file-node`, () => {
url: ``,
})

expect(value).rejects.toMatch(`wrong url: `)
expect(value).rejects.toMatch(
`url passed to createRemoteFileNode is either missing or not a proper web uri: `
)
})

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

expect(value).rejects.toMatch(`wrong url: `)
expect(value).rejects.toMatch(
`url passed to createRemoteFileNode is either missing or not a proper web uri: `
)

expect(progressBar.total).toBe(0)
expect(progressBar.tick).not.toHaveBeenCalled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ module.exports = ({
}

if (!url || isWebUri(url) === undefined) {
return Promise.reject(`wrong url: ${url}`)
return Promise.reject(
`url passed to createRemoteFileNode is either missing or not a proper web uri: ${url}`
)
}

if (totalJobs === 0) {
Expand Down

0 comments on commit a4fd928

Please sign in to comment.