Skip to content

Commit

Permalink
expose api errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer committed Sep 11, 2024
1 parent 1a769ff commit 82263bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions posthog/clickhouse/client/execute_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sentry_sdk
import structlog
from prometheus_client import Histogram
from rest_framework.exceptions import NotFound
from rest_framework.exceptions import NotFound, APIException

from posthog import celery, redis
from posthog.clickhouse.client.async_task_chain import add_task_to_on_commit
Expand Down Expand Up @@ -198,7 +198,7 @@ def execute_process_query(
raise
except Exception as err:
query_status.results = None # Clear results in case they are faulty
if isinstance(err, ExposedHogQLError | ExposedCHQueryError) or is_staff_user:
if isinstance(err, APIException | ExposedHogQLError | ExposedCHQueryError) or is_staff_user:
# We can only expose the error message if it's a known safe error OR if the user is PostHog staff
query_status.error_message = str(err)
logger.exception("Error processing query async", team_id=team_id, query_id=query_id, exc_info=True)
Expand Down

0 comments on commit 82263bd

Please sign in to comment.