vatsrahul1001 commented on code in PR #45731:
URL: https://github.com/apache/airflow/pull/45731#discussion_r1925265578


##########
airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -206,31 +206,20 @@ def create_backfill(
             reprocess_behavior=backfill_request.reprocess_behavior,
         )
         return BackfillResponse.model_validate(backfill_obj)
-    except AlreadyRunningBackfill:
-        raise HTTPException(
-            status_code=status.HTTP_409_CONFLICT,
-            detail=f"There is already a running backfill for dag 
{backfill_request.dag_id}",
-        )
-    except DagNoScheduleException:
-        raise HTTPException(
-            status_code=status.HTTP_409_CONFLICT,
-            detail=f"{backfill_request.dag_id} has no schedule",
-        )
-
-    except DagNotFound:
-        raise HTTPException(
-            status_code=status.HTTP_404_NOT_FOUND,
-            detail=f"Could not find dag {backfill_request.dag_id}",
-        )
+    except (
+        AlreadyRunningBackfill,
+        InvalidReprocessBehavior,
+        InvalidBackfillDirection,
+        DagNoScheduleException,
+        DagNotFound,
+    ) as e:
+        raise RequestValidationError(str(e))
 
 
 @backfills_router.post(
     path="/dry_run",
     responses=create_openapi_http_exception_doc(
-        [
-            status.HTTP_404_NOT_FOUND,
-            status.HTTP_409_CONFLICT,
-        ]
+        [status.HTTP_404_NOT_FOUND, status.HTTP_409_CONFLICT, 
status.HTTP_422_UNPROCESSABLE_ENTITY]

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to