ashb commented on a change in pull request #11335:
URL: https://github.com/apache/airflow/pull/11335#discussion_r511863077
##########
File path: airflow/api_connexion/endpoints/task_instance_endpoint.py
##########
@@ -286,9 +287,13 @@ def post_set_task_instances_state(dag_id, session):
except ValidationError as err:
raise BadRequest(detail=str(err.messages))
- dag = current_app.dag_bag.get_dag(dag_id)
- if not dag:
- error_message = "Dag ID {} not found".format(dag_id)
+ error_message = "Dag ID {} not found".format(dag_id)
+ try:
+ dag = current_app.dag_bag.get_dag(dag_id)
+ if not dag:
+ raise NotFound(error_message)
+ except SerializedDagNotFound:
Review comment:
If we made AirflowNotFound inherit from connextion.NotFound this code
could be a simpler here.
WDYT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]