0
# Exception Handling
1
2
Comprehensive exception hierarchy for error handling, timeout management, and workflow recovery. Airflow provides structured exceptions for different failure scenarios.
3
4
## Capabilities
5
6
### Core Exceptions
7
8
Base exception classes for Airflow errors.
9
10
```python { .api }
11
class AirflowException(Exception):
12
"""Base exception for all Airflow errors."""
13
14
class AirflowBadRequest(AirflowException):
15
"""Exception for bad request errors."""
16
17
class AirflowNotFoundException(AirflowException):
18
"""Exception when requested resource is not found."""
19
20
class AirflowConfigException(AirflowException):
21
"""Exception for configuration errors."""
22
```
23
24
### Task Execution Exceptions
25
26
Exceptions related to task execution and lifecycle.
27
28
```python { .api }
29
class AirflowTaskTimeout(AirflowException):
30
"""Exception when task exceeds execution timeout."""
31
32
class AirflowSensorTimeout(AirflowException):
33
"""Exception when sensor times out waiting for condition."""
34
35
class AirflowRescheduleException(AirflowException):
36
"""Exception to reschedule task for later execution."""
37
38
def __init__(self, reschedule_date: datetime):
39
"""
40
Create reschedule exception.
41
42
Args:
43
reschedule_date: When to reschedule the task
44
"""
45
46
class AirflowSkipException(AirflowException):
47
"""Exception to skip task execution."""
48
49
class AirflowFailException(AirflowException):
50
"""Exception to mark task as failed."""
51
```
52
53
### Callback and Retry Exceptions
54
55
Handle callback failures and retry logic.
56
57
```python { .api }
58
class AirflowRetryException(AirflowException):
59
"""Exception to trigger task retry."""
60
61
class AirflowCallbackException(AirflowException):
62
"""Exception in callback execution."""
63
```
64
65
### Statistics and Metrics Exceptions
66
67
Exceptions for metrics and statistics collection.
68
69
```python { .api }
70
class InvalidStatsNameException(AirflowException):
71
"""Exception for invalid statistics names."""
72
```
73
74
## Types
75
76
```python { .api }
77
from datetime import datetime
78
from typing import Optional
79
80
ExceptionType = type[Exception]
81
```