This is an automated email from the ASF dual-hosted git repository.
bbovenzi 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 b3cae77218 Include message in graph errors (#23021)
b3cae77218 is described below
commit b3cae77218788671a72411a344aab42a3c58e89c
Author: Brent Bovenzi <[email protected]>
AuthorDate: Fri Apr 15 08:14:37 2022 -0500
Include message in graph errors (#23021)
---
airflow/www/static/js/graph.js | 5 +++--
airflow/www/views.py | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js
index ecdcb921a9..43aea08f3f 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -450,8 +450,9 @@ function handleRefresh() {
setTimeout(() => { $('#loading-dots').hide(); }, 500);
$('#error').hide();
},
- ).fail((_, textStatus, err) => {
- $('#error_msg').text(`${textStatus}: ${err}`);
+ ).fail((response, textStatus, err) => {
+ const description = (response.responseJSON &&
response.responseJSON.error) || 'Something went wrong.';
+ $('#error_msg').text(`${textStatus}: ${err} ${description}`);
$('#error').show();
setTimeout(() => { $('#loading-dots').hide(); }, 500);
$('#chart_section').hide(1000);
diff --git a/airflow/www/views.py b/airflow/www/views.py
index f0ca663611..de672a0416 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -3377,7 +3377,9 @@ class Airflow(AirflowBaseView):
if dttm:
dttm = timezone.parse(dttm)
else:
- return "Error: Invalid execution_date"
+ response = jsonify({'error': f"Invalid execution_date {dttm}"})
+ response.status_code = 400
+ return response
with create_session() as session:
task_instances = {