commitizen / commitizen/cz-cli
Remove stack trace from error when committing without staging files
- Ngôn ngữ chính
- JavaScript
- Star
- 17.5k
- Fork
- 566
- Merge trung bình
- 8 giờ 16 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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?
````
Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện vấn đề với `git cz` khi không có tệp nào được stage, sau đó đọc đường dẫn lỗi trong `dist/cli/strategies/git-cz.js` và staging callback trong `dist/commitizen/staging.js`. Hoàn thành khi lỗi đã biết vẫn xuất hiện, nhưng chỉ dưới dạng `Error: No files added to staging! Did you forget to run git add?`, không có stack trace.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 55/100