raise exception when you meet the error condition ( in your case: when file is not sucesfully parsed)
raise ValueError('File not parsed completely/correctly')
raise relevant error type with suitable message
Yes, raise AirflowException, this will cause the task to move immediately to failure state.
AirflowException
from airflow import AirflowException
ValueError can be used for fail and retry.
ValueError
AirflowFailException is now available to make the task fail without retries
AirflowFailException