Skip to content
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

chore: stop logging "SyntaxError" as exceptions #21787

Merged
merged 4 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ def execute_sql_statement( # pylint: disable=too-many-arguments,too-many-statem
if query.status == QueryStatus.STOPPED:
raise SqlLabQueryStoppedException() from ex

logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
logger.debug("Query %d: %s", query.id, ex)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the debug? Or does it also show up as exceptions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naw we end up eating it and converting to a payload i'll add it back

raise SqlLabException(db_engine_spec.extract_error_message(ex)) from ex

logger.debug("Query %d: Fetching cursor description", query.id)
Expand Down
1 change: 1 addition & 0 deletions superset/sqllab/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def run( # pylint: disable=too-many-statements,useless-suppression
) from ex
raise ex
except Exception as ex:
logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need the exception info in general it's better to use logger.exception, as it does that automatically:

Suggested change
logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
logger.exception("Query %d: %s", query.id, type(ex))

raise SqlLabException(self._execution_context, exception=ex) from ex

def _try_get_existing_query(self) -> Optional[Query]:
Expand Down