Recover from panics in commands

Print an error message with the panic location, if available.