Added correct ZSH error handling code.

This is quite important and can solve weird little glitches in the shell.