commitizen / commitizen/cz-cli
Remove stack trace from error when committing without staging files
- 主要语言
- JavaScript
- 星标
- 17.5k
- 派生
- 566
- 平均合并
- 8 小时 16 分钟
- 30 天内合并 PR
- 1
描述
When you run `git cz` when there are no files staged, the error message includes a stack trace. The stack trace is unnecessary and makes a known error look like an unexpected failure.
instead of this:
````
$ git cz
/usr/local/lib/node_modules/commitizen/dist/cli/strategies/git-cz.js:87
throw new Error('No files added to staging! Did you forget to run git add?');
^
Error: No files added to staging! Did you forget to run git add?
at /usr/local/lib/node_modules/commitizen/dist/cli/strategies/git-cz.js:87:13
at /usr/local/lib/node_modules/commitizen/dist/commitizen/staging.js:25:5
at ChildProcess.exithandler (child_process.js:263:7)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Socket.stream.socket.on (internal/child_process.js:348:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:547:12)
````
It should instead look like this:
````
$ git cz
Error: No files added to staging! Did you forget to run git add?
````
贡献指南
调研方向
在没有暂存任何文件时使用 `git cz` 重现该问题,然后阅读 `dist/cli/strategies/git-cz.js` 中的错误路径以及 `dist/commitizen/staging.js` 中的 staging 回调。完成的标准是已知错误仍然出现,但仅显示为 `Error: No files added to staging! Did you forget to run git add?`,不带堆栈跟踪。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100