2017-08-05 17:46:39 +00:00
|
|
|
const PrettyError = require('pretty-error')
|
|
|
|
|
|
|
|
// Start default instance
|
|
|
|
const pe = PrettyError.start()
|
|
|
|
|
|
|
|
// Configure prettyError instance
|
|
|
|
pe.skipPackage('regenerator-runtime')
|
|
|
|
pe.skipPackage('babel-runtime')
|
|
|
|
pe.skipPackage('core-js')
|
2017-08-12 16:11:36 +00:00
|
|
|
|
2017-12-12 09:42:29 +00:00
|
|
|
// Skip node internals
|
2017-08-12 16:11:36 +00:00
|
|
|
pe.skip((traceLine, lineNumber) => {
|
2017-12-12 09:42:29 +00:00
|
|
|
if (!traceLine.file) {
|
2017-08-12 16:11:36 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-08-05 17:46:39 +00:00
|
|
|
pe.skipNodeFiles()
|
|
|
|
|
|
|
|
// Console error unhandled promises
|
|
|
|
process.on('unhandledRejection', function (err) {
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
console.log(pe.render(err))
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
pe
|
|
|
|
}
|