It's actually possible to produce a stack trace of sorts, if you use a lot of bash functions. One possible implementation is: https://github.com/TritonDataCenter/sdc-headnode/blob/master...
some-command || fail "message"
to produce a stack trace and exit the shell in case of non-zero exit status from some-command, or write some-command || softfail "message" || return $?
in case you want to produce a stack trace and return from the function.