brainlife / cli

brainlife.io Command Line Interface (CLI)
https://brainlife.io
MIT License
2 stars 6 forks source link

display all error messages via console.error #19

Closed soichih closed 6 years ago

soichih commented 6 years ago

Currently most error messages are suppressed in case --json flag is set. It should be updated so that all error messages will be displayed in the plain text at all time via console.error (stdout is for --json output if the flag is set).

We also don't need to display error messages in json when --json is specified. If there is an error, it should simply exit 1 with no stdout content.

soichih commented 6 years ago

Adding to this thread.. Right now, when something fails, I can't tell what went wrong or how to fix it.

Like...

hayashis@carbonate(h1):/N/dc2/scratch/hayashis/bold5000/BOLD5000_Structural/CSI1_Structural/DSI_MB3-253d_AP_CSI1 $ bl dataset upload -p 5a74ccd66ed91402ce400cc6 -d neuro/dwi -s test --dwi 20171117_114153DSIMB3253dAPSTS3S1s029a001.nii.gz --bvecs 20171117_114153DSIMB3253dAPSTS3S1s029a001.bvec --bvals 20171117_114153DSIMB3253dAPSTS3S1s029a001.bval
Waiting for upload task to be ready...
SERVICE: soichih/sca-service-noop fe            
STATUS: Successfully finished
(7 seconds ago)
Dataset successfully uploaded
Validating data... (brain-life/validator-neuro-dwi)
SERVICE: brain-life/validator-neuro-dwi
STATUS: failed
Error: finished with exit code 1

We should improve the way error is handled to give user more information about what went wrong, how to fix it.