-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add descriptive error msgs #1150
feat: add descriptive error msgs #1150
Conversation
if previous_query_status != QueryExecutionStatus.DONE.value: | ||
raise Exception(GENERIC_QUERY_FAILURE_MSG) | ||
raise Exception(get_datadoc_error_message(previous_query_execution_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@czgu do you know why we raise the exception in the next query cell run task, instead of just raising it at the end of the run_query
task? In which case we dont need to pass over the previous query result over and can throw the error message directly
@@ -149,14 +150,41 @@ def _start_query_execution_task( | |||
return query_execution.id | |||
|
|||
|
|||
def get_datadoc_error_message(query_execution_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use @with_session instead
)[0] | ||
data_cell_name = datadoc_logic.get_data_cell_by_id( | ||
data_cell_id, session=session | ||
).meta.get("title") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title might be empty, can you add a default value here
data_cell_name = datadoc_logic.get_data_cell_by_id( | ||
data_cell_id, session=session | ||
).meta.get("title") | ||
query_execution_error = qe_logic.get_query_execution_by_id( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use get_query_execution_error
@with_session | ||
def get_datadoc_error_message(query_execution_id, data_cell_id=None, session=None): | ||
if not data_cell_id: | ||
_, data_cell_id = qe_logic.get_datadoc_id_from_query_execution_id( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for my last comment, I just realized I made a mistake because you need the previous cell id, not the current one
data_cell_name = datadoc_logic.get_data_cell_by_id( | ||
data_cell_id, session=session | ||
).meta.get("title") | ||
if not data_cell_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_cell_name = datadoc_logic.get_data_cell_by_id(
data_cell_id, session=session
).meta.get("title", f"Untitled Cell Id [{data_cell_id}]")
) | ||
query_execution_error_message = None | ||
if query_execution_error: | ||
if query_execution_error.error_message_extracted: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_execution_error_message = query_execution_error.error_message_extracted if query_execution_error.error_message_extracted else query_execution_error.error_message
error_msg = (f'Failure in "{data_cell_name}": {query_execution_error_message}'
if query_execution_error_message is not None
else GENERIC_QUERY_FAILURE_MSG
)[:description_len]
* feat: add descriptive error msgs * fix: only get error msg if exec error * chore: refactor get_datadoc_error_message * chore: refactor helper func, del data_cell_id arg
* feat: add descriptive error msgs * fix: only get error msg if exec error * chore: refactor get_datadoc_error_message * chore: refactor helper func, del data_cell_id arg
Adds more descriptive error messages when running a datadoc fails. This error message contains the exact error from the query cell, and the name of the failed query cell to help pinpoint the location of the error.