mirror of
https://github.com/zhigang1992/bundlewatch.git
synced 2026-04-28 20:05:20 +08:00
better debugging output
This commit is contained in:
@@ -5,8 +5,16 @@ const stderr = console.error // eslint-disable-line no-console
|
||||
|
||||
const debug = error => {
|
||||
if (process.env.DEBUG) {
|
||||
const debugObject = error.response
|
||||
? error.response.data
|
||||
: error.response
|
||||
stdout(chalk.greenBright(`[DEBUG] ${error.message}`))
|
||||
stderr(error)
|
||||
try {
|
||||
stderr(JSON.stringify(debugObject, undefined, 2))
|
||||
} catch (e) {
|
||||
// eat it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user