commitizen / commitizen/cz-cli

Remove stack trace from error when committing without staging files

Ouverte
#473 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
17.5k
Forks
566
Merge moyen
8 h 16 min
PR mergées (30 j)
1

Description

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?
````

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.