Skip to content

Commit

Permalink
fix: When rejecting, use new Error and error.message respectively. (#113
Browse files Browse the repository at this point in the history
)

Fixes #112
  • Loading branch information
okonet committed Dec 19, 2016
1 parent 0d5a841 commit 97ad4b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -54,7 +54,7 @@ cosmiconfig('lint-staged', {

if (tasks.length) {
new Listr(tasks, { concurrent }).run().catch((error) => {
console.error(error)
console.error(error.message)
process.exit(1)
})
}
Expand Down
5 changes: 2 additions & 3 deletions src/runScript.js
Expand Up @@ -17,13 +17,12 @@ module.exports = function runScript(commands, pathsToLint, packageJson, gitDir)
resolve(`${ linter } passed!`)
})
.catch((err) => {
reject(`
reject(new Error(`
🚫 ${ linter } found some errors. Please fix them and try committing again.
${ err.stderr }
${ err.stdout }
`
)
`))
})
})
} catch (err) {
Expand Down

0 comments on commit 97ad4b4

Please sign in to comment.