2424from http import HTTPStatus
2525from typing import TYPE_CHECKING , NamedTuple
2626
27+ from airflow .sdk .exceptions import AirflowException , AirflowNotFoundException
28+
2729if TYPE_CHECKING :
2830 from airflow .models import DagRun
2931
3032
31- class AirflowException (Exception ):
32- """
33- Base class for all Airflow's errors.
34-
35- Each custom exception should be derived from this class.
36- """
37-
38- status_code = HTTPStatus .INTERNAL_SERVER_ERROR
39-
40- def serialize (self ):
41- cls = self .__class__
42- return f"{ cls .__module__ } .{ cls .__name__ } " , (str (self ),), {}
43-
44-
4533class AirflowBadRequest (AirflowException ):
4634 """Raise when the application or server cannot handle the request."""
4735
@@ -52,12 +40,6 @@ class TaskNotFound(AirflowException):
5240 """Raise when a Task is not available in the system."""
5341
5442
55- class AirflowNotFoundException (AirflowException ):
56- """Raise when the requested object/resource is not available in the system."""
57-
58- status_code = HTTPStatus .NOT_FOUND
59-
60-
6143class AirflowConfigException (AirflowException ):
6244 """Raise when there is configuration problem."""
6345
@@ -66,10 +48,6 @@ class InvalidStatsNameException(AirflowException):
6648 """Raise when name of the stats is invalid."""
6749
6850
69- class AirflowFailException (AirflowException ):
70- """Raise when the task should be failed without retrying."""
71-
72-
7351class AirflowOptionalProviderFeatureException (AirflowException ):
7452 """Raise by providers when imports are missing for optional provider features."""
7553
0 commit comments