commitizen / commitizen/cz-cli

Remove stack trace from error when committing without staging files

Abierto
#473 3 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
17.5k
Forks
566
Merge medio
8 h 16 min
PR fusionados (30 d)
1

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.