This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 64d012fa84 Catch `ParamValidationError` in view when triggering a DAG 
(#23217)
64d012fa84 is described below

commit 64d012fa8484c799b21a77f8e730cd6392ff01a7
Author: Ephraim Anierobi <[email protected]>
AuthorDate: Mon Apr 25 13:54:11 2022 +0100

    Catch `ParamValidationError` in view when triggering a DAG (#23217)
    
    dag.create_dagrun can raise `ParamValidationError`. We should capture it
    when manually triggering a dag to avoid breaking the UI
---
 airflow/www/views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/www/views.py b/airflow/www/views.py
index 147132f93b..de5ef4c482 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -99,7 +99,7 @@ from airflow.api.common.mark_tasks import (
 )
 from airflow.compat.functools import cached_property
 from airflow.configuration import AIRFLOW_CONFIG, conf
-from airflow.exceptions import AirflowException
+from airflow.exceptions import AirflowException, ParamValidationError
 from airflow.executors.executor_loader import ExecutorLoader
 from airflow.jobs.base_job import BaseJob
 from airflow.jobs.scheduler_job import SchedulerJob
@@ -1945,7 +1945,7 @@ class Airflow(AirflowBaseView):
                 dag_hash=current_app.dag_bag.dags_hash.get(dag_id),
                 run_id=run_id,
             )
-        except ValueError as ve:
+        except (ValueError, ParamValidationError) as ve:
             flash(f"{ve}", "error")
             form = DateTimeForm(data={'execution_date': execution_date})
             return self.render_template(

Reply via email to