-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return error levels/codes to shell on error #479
Comments
Hello again @pageauc, |
I think what the user may be looking for (correct me if I'm wrong) is a list of different error codes for different exit status situations. This helps tremendously when someone wants to use your drive script in their script and notify the user of why an error was thrown. You have already included text descriptions with your script but the user may want to do it a different way. Otherwise if you don't assign exit codes to different errors, they only know that drive threw an "exit 1" (as an example) but there is no explanation why (if the user wants to suppress your output). Usually in C programming there can be an "errors.h" file or something similar that lists all error types. For example:
And so on. This list could be big. This makes the error situations very manageable when someone wants to cleanly notify the user of why the script ended without a 0 exit code. |
Yes that is exactly what I am trying to do with my bash script. I am automating recording and uploading video files in a round robin sequence. If a process fails (record, upload, etc) then I want to take appropriate action like retry upload, record etc. I also have to check to make sure that if multiple instances of the script are run, that the current state is not crashed eg tries to duplicate something that is already in progress. I need to report meaningful status, warning or error message(s) to the users(s), It is nice to have self correcting code but in some cases users might need to resolve a problem. A list of exit codes would be great since one process can communicate to another like a record failing so don't upload it. If problem persists then issue appropriate message. This works Thanks Claude ... |
Hi @odeke-em so do you think you can implement these error codes? |
I don't know about now as I don't have much free time. In the next two months or so, sure, given the number of unfixed bugs plus my school commitments. Otherwise if anyone would like they can submit a PR and I'll definitely review it. |
Ok. These are my suggestions but not sure if you have appropriate points 0 - Sync Successful On Fri, Nov 27, 2015 at 10:06 AM, Emmanuel T Odeke <notifications@github.com
See my YouTube Channel at http://www.youtube.com/user/pageaucp |
+1 for that |
I need it too after spent files with a pull/push script with non possiblity to read status code 504 & 505 |
Fixes #479. Now most errors returned from drive have a status/return code that will be passed to the external environment on failure. - Before ```shell $ drive pull nonExistant $ echo $? 1 ``` - After ```shell $ drive pull nonExistant $ echo $? 8 ```
Fixes #479. Now most errors returned from drive have a status/return code that will be passed to the external environment on failure. - Before ```shell $ drive pull nonExistant Resolving... – '/ysms' aka '/Users/emmanuelodeke/emm.odeke/nonExistant' doesn't exist locally nor remotely $ echo $? 1 $ mkfifo pxm $ drive push pxm Resolving... – /pxm (/Users/emmanuelodeke/emm.odeke/pxm) is a named pipe, yet not reading from it $ echo $? 1 ``` - After ```shell $ drive pull nonExistant $ echo $? 8 $ mkfifo pxm $ drive push pxm Resolving... – /pxm (/Users/emmanuelodeke/emm.odeke/pxm) is a named pipe, yet not reading from it $ echo $? 22 ```
Hey folks. My apologies for the long wait, I have been very busy for the last few months. However, this evening I got some time and whipped up a PR #608. It has a couple of status/return codes and you can always see the reference in src/errors.go. I'll merge it in and we'll keep updating it as we go. |
Fixes #479. Now most errors returned from drive have a status/return code that will be passed to the external environment on failure. - Before ```shell $ drive pull nonExistant Resolving... – '/ysms' aka '/Users/emmanuelodeke/emm.odeke/nonExistant' doesn't exist locally nor remotely $ echo $? 1 $ mkfifo pxm $ drive push pxm Resolving... – /pxm (/Users/emmanuelodeke/emm.odeke/pxm) is a named pipe, yet not reading from it $ echo $? 1 ``` - After ```shell $ drive pull nonExistant $ echo $? 8 $ mkfifo pxm $ drive push pxm Resolving... – /pxm (/Users/emmanuelodeke/emm.odeke/pxm) is a named pipe, yet not reading from it $ echo $? 22 ```
Auto closed by PR #608, please re-open if persists. |
Thanks a lot I try it now |
I am using the program on a raspberry pi bash script using Raspbian Jessie. I want to detect an errorlevel if there is an error like not being able to connect or a failed push/pull etc. Normally a program will return an error level of 0 if successful and non zero if a problem is encountered.
Can you confirm if there are error levels returned in this program.
Thanks Claude ...
The text was updated successfully, but these errors were encountered: