diff --git a/airflow/exceptions.py b/airflow/exceptions.py index 95fa9e3276545..2f1e53e182a10 100644 --- a/airflow/exceptions.py +++ b/airflow/exceptions.py @@ -21,6 +21,7 @@ """Exceptions used by Airflow""" import datetime import warnings +from http import HTTPStatus from typing import Any, Dict, List, NamedTuple, Optional, Sized @@ -31,19 +32,19 @@ class AirflowException(Exception): Each custom exception should be derived from this class. """ - status_code = 500 + status_code = HTTPStatus.INTERNAL_SERVER_ERROR class AirflowBadRequest(AirflowException): """Raise when the application or server cannot handle the request.""" - status_code = 400 + status_code = HTTPStatus.BAD_REQUEST class AirflowNotFoundException(AirflowException): """Raise when the requested object/resource is not available in the system.""" - status_code = 404 + status_code = HTTPStatus.NOT_FOUND class AirflowConfigException(AirflowException):