If you can prevent an error from occurring, it is much better. For instance you can always avoid a divide by zero error by testing with a statement such as if(divisor!=0) before dividing.
However, there are sometimes situations when you need to catch an error.