You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues and haven't found one that matches what I'm reporting or requesting now.
If this is a bug report, I have searched the Bash changelog for information that may explain or provide clues to the behavior I'm observing and reference it in the body of the report.
Description
It would be useful if the go-script framework used custom, clearly defined exit codes to signify the type of error that occurred.
The main reason I am proposing this is that when a user wants to handle errors in their application via traps or set -eu, the several cases that go-script returns 1 become problematic. For instance, I have a set a error trap in my scripts that outputs a nice stack trace on error. But even bash completion failure triggers the trap (as mentioned here), as do bad flags (eg go-template commands --bad which has its own nice error output), etc. To handle this situation one has to perform ugly checks, like checking if a file exists in the BASH_SOURCE array or if a function exists in the FUNCNAME array. Having custom error codes other than 1 would make handling this situation much easier, as the user can filter out go-script-bash codes and handle only the rest in their custom error trap.
Custom error codes could be based for instance on sysexits.h and new ones introduced in the cases sysexit.h doesn't cover.
The text was updated successfully, but these errors were encountered:
Due diligence
Description
It would be useful if the go-script framework used custom, clearly defined exit codes to signify the type of error that occurred.
The main reason I am proposing this is that when a user wants to handle errors in their application via traps or
set -eu
, the several cases that go-script returns 1 become problematic. For instance, I have a set a error trap in my scripts that outputs a nice stack trace on error. But even bash completion failure triggers the trap (as mentioned here), as do bad flags (eggo-template commands --bad
which has its own nice error output), etc. To handle this situation one has to perform ugly checks, like checking if a file exists in the BASH_SOURCE array or if a function exists in the FUNCNAME array. Having custom error codes other than 1 would make handling this situation much easier, as the user can filter out go-script-bash codes and handle only the rest in their custom error trap.Custom error codes could be based for instance on
sysexits.h
and new ones introduced in the casessysexit.h
doesn't cover.The text was updated successfully, but these errors were encountered: