add err-print, slight output improvement, docs
[errhandle.git] / README
diff --git a/README b/README
index 180c18842f59280a33294e1c9f5a6c39ea2295b3..b8e85f293991ede0c82367c9c54a2b36a4a0c9d9 100644 (file)
--- a/README
+++ b/README
@@ -1,20 +1,20 @@
-Functions to deal with errors in bash
+Bash stack trace and error handling functions
 
-err: usually, just source this. contains the others and runs errcatch
+Usually, just copy the err file and source it. Then on any non-zero
+return code outside of a conditional, the program will exit and print a
+stack trace.
 
-errcatch: set a trap on error to do bash-trace and exit
-errallow: undo errcatch
-errexit: exit and print stack trace
-bash-trace: print stack trace (best bash stack trace ever)
+The err file has some functions which you may want to call manually for
+different or additional error handling. See the comments at the start of
+each one.
 
-the err* functions depend on bash-trace.
-
-For scripts without any nested function calls, this is usually sufficient:
+For scripts where functions are not used, you can optionally use a more
+minimal approach:
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
-Cleanup commands or functions can be appended to the ERR trap after a
-semicolon within the single quotes.
+In the above line, cleanup commands or functions can be appended to the
+ERR trap after a semicolon within the single quotes.
 
 Related: see my bash script template repo, at https://iankelling.org/git.