Handles errors.