Skip to content

Commit

Permalink
fix: avoid joi validation error when using reporter.panic (#28291)
Browse files Browse the repository at this point in the history
- previously just passing the error object would produce a joi
  error

```
Failed to validate error Error [ValidationError]: "name" is not allowed
    at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19)
    at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31)
    at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21)
    at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32)
    at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59)
    at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34)
    at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16)
    at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 {
  isJoi: true,
```
  • Loading branch information
rburgst committed Nov 27, 2020
1 parent 2b8fe12 commit 231cf9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-sharp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function createJob(job, { reporter }) {
}

promise.catch(err => {
reporter.panic(err)
reporter.panic(`error converting image`, err)
})

return promise
Expand Down

0 comments on commit 231cf9f

Please sign in to comment.