Improve error handling when given certain errors.