checks for error conditions