catch errors.