Detecting expected errors