The only way I know of printing a backtrace for errors in batch invocation of Emacs is by setting debug-on-error
inline like so:
$ emacs -batch --eval "(setq debug-on-error t)" -f "my/foo-function"
Is there a more idiomatic method for displaying backtraces for errors in batch mode?