decode errors before passing them to sys.exit