mirror of https://github.com/apache/superset.git
fix: safer error message in alerts (#27019)
This commit is contained in:
parent
c77fc7dbaf
commit
686ce33ea5
|
@ -150,7 +150,7 @@ class AlertCommand(BaseCommand):
|
||||||
rendered_sql, ALERT_SQL_LIMIT
|
rendered_sql, ALERT_SQL_LIMIT
|
||||||
)
|
)
|
||||||
|
|
||||||
_, username = get_executor(
|
executor, username = get_executor( # pylint: disable=unused-variable
|
||||||
executor_types=app.config["ALERT_REPORTS_EXECUTE_AS"],
|
executor_types=app.config["ALERT_REPORTS_EXECUTE_AS"],
|
||||||
model=self._report_schedule,
|
model=self._report_schedule,
|
||||||
)
|
)
|
||||||
|
@ -169,7 +169,12 @@ class AlertCommand(BaseCommand):
|
||||||
logger.warning("A timeout occurred while executing the alert query: %s", ex)
|
logger.warning("A timeout occurred while executing the alert query: %s", ex)
|
||||||
raise AlertQueryTimeout() from ex
|
raise AlertQueryTimeout() from ex
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise AlertQueryError(message=str(ex)) from ex
|
logger.exception("An error occurred when running alert query")
|
||||||
|
# The exception message here can reveal to much information to malicious
|
||||||
|
# users, so we raise a generic message.
|
||||||
|
raise AlertQueryError(
|
||||||
|
message=_("An error occurred when running alert query")
|
||||||
|
) from ex
|
||||||
|
|
||||||
def validate(self) -> None:
|
def validate(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue