Browse Source

ref: fix typing in sentry.db.postgres.decorators (#62432)

<!-- Describe your PR here. -->
anthony sottile 1 year ago
parent
commit
c0c799c680
2 changed files with 1 additions and 4 deletions
  1. 0 1
      pyproject.toml
  2. 1 3
      src/sentry/db/postgres/decorators.py

+ 0 - 1
pyproject.toml

@@ -284,7 +284,6 @@ module = [
     "sentry.db.models.utils",
     "sentry.db.postgres.base",
     "sentry.db.postgres.creation",
-    "sentry.db.postgres.decorators",
     "sentry.db.router",
     "sentry.digests.notifications",
     "sentry.discover.endpoints.discover_key_transactions",

+ 1 - 3
src/sentry/db/postgres/decorators.py

@@ -90,8 +90,6 @@ def more_better_error_messages(func):
         try:
             return func(self, sql, *args, **kwargs)
         except Exception as e:
-            exc_info = sys.exc_info()
-            msg = f"{e!r}\nSQL: {sql}"
-            raise exc_info[0](msg).with_traceback(exc_info[2])
+            raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
 
     return inner