mixu / gr

Multiple git repository management tool
http://mixu.net/gr/
674 stars 104 forks source link

Check config format, add a useful message #87

Open Marwe opened 6 years ago

Marwe commented 6 years ago

I messed up my ~/.grconfig.json (excess comma at end of a list due to deletion of last entry) and found the resulting error message to be not exactly informative. Maybe this can be handled better, such that a (syntax) check is included and a useful "config messed up"-message can be shown.

gr git status
/usr/lib/node_modules/git-run/lib/command-requirements.js:8
    if (gitCommand.stderr.toString().replace(/(\r\n|\n|\r)/gm, '').trim()) {
                         ^

TypeError: Cannot read property 'toString' of null
    at Object.git (/usr/lib/node_modules/git-run/lib/command-requirements.js:8:26)
    at Object.module.exports [as handle] (/usr/lib/node_modules/git-run/plugins/run.js:29:38)
    at next (/usr/lib/node_modules/git-run/index.js:244:11)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)
    at next (/usr/lib/node_modules/git-run/index.js:227:14)

Thanks for this great piece of software!

roytruelove commented 6 years ago

My guess is that this isn't handled super elegantly because it's not expected that the users will be editing that file directly