Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Better logs of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Nov 27, 2020
1 parent df3b70b commit bf32ad9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

'use strict'

const debug = require('debug')('dependency-check')
const requiredNodeEngineMinimum = parseInt(require('./package.json').engines.node.match(/^>=(\d+)\./)[1], 10)
const currentNodeEngine = parseInt(process.version.match(/^v(\d+)\./)[1], 10)

Expand Down Expand Up @@ -96,6 +97,11 @@ check({
extensions: extensions(args.e),
detective: args.detective
})
.catch(err => {
console.error('An unexpected error in initial stage:', err.message)
debug(err.stack)
process.exit(1)
})
.then(data => {
const pkg = data.package
const deps = data.used
Expand Down Expand Up @@ -138,6 +144,7 @@ check({
process.exit(args.ignore || !failed ? 0 : 1)
})
.catch(err => {
console.error(err.message)
console.error('An unexpected error happened:', err.message)
debug(err.stack)
process.exit(1)
})

0 comments on commit bf32ad9

Please sign in to comment.