pear-terminal 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +3 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -505,7 +505,7 @@ function explain(bail = {}) {
505
505
  Bare.exit(1)
506
506
  }
507
507
  }
508
- const messageUsage = (bail) => bail.err.message
508
+ const messageUsage = (bail) => bail.err.info?.message ?? bail.err.message
509
509
  const messageOnly = (bail) => bail.err.message
510
510
  const opFail = (cmd) => cmd.err.info.message
511
511
  const codemap = new Map([
@@ -517,13 +517,14 @@ function explain(bail = {}) {
517
517
  ['MISSING_ARG', (bail) => bail.arg.value],
518
518
  ['INVALID', messageUsage],
519
519
  ['ERR_INVALID_INPUT', messageUsage],
520
+ ['ERR_INVALID_CONFIG', messageUsage],
520
521
  ['ERR_LEGACY', messageOnly],
521
522
  ['ERR_INVALID_TEMPLATE', messageOnly],
522
523
  ['ERR_DIR_NONEMPTY', messageOnly],
523
524
  ['ERR_OPERATION_FAILED', opFail]
524
525
  ])
525
526
  const nouse = [messageOnly, opFail]
526
- const code = codemap.has(bail.err?.code) ? bail.err.code : bail.reason
527
+ const code = bail?.err?.info?.code ?? (codemap.has(bail.err?.code) ? bail.err.code : bail.reason)
527
528
  const ref = codemap.get(code)
528
529
  const reason = codemap.has(code) ? (codemap.get(code)(bail) ?? bail.reason) : bail.reason
529
530
  Bare.exitCode = 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-terminal",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "index.js",
5
5
  "type": "commonjs",
6
6
  "description": "Pear Terminal User Interface library",