Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

fix: Minor fix in exc middleware, removed extra pyupgrade hook (#245)

Chandrasekharan M70a02ff8333b
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 263c5fd12..181d316ee 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -132,13 +132,6 @@ repos:
rev: v1.1.2
hooks:
- id: htmlhint
- - repo: https://github.com/asottile/pyupgrade
- rev: v3.15.1
- hooks:
- - id: pyupgrade
- entry: pyupgrade --py38-plus --keep-runtime-typing
- types:
- - python
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
diff --git a/backend/account/authentication_controller.py b/backend/account/authentication_controller.py
index 72c1c2de2..ede02b04a 100644
--- a/backend/account/authentication_controller.py
+++ b/backend/account/authentication_controller.py
@@ -159,7 +159,7 @@ class AuthenticationController:
except Exception as ex:
#
self.user_logout(request)
- if ex.code == AuthorizationErrorCode.USF: # type: ignore
+ if hasattr(ex, "code") and ex.code == AuthorizationErrorCode.USF: # type: ignore
response = Response(
status=status.HTTP_412_PRECONDITION_FAILED,
data={"domain": ex.data.get("domain")}, # type: ignore
diff --git a/backend/middleware/exception.py b/backend/middleware/exception.py
index 1bb9e91e3..6f4ba637f 100644
--- a/backend/middleware/exception.py
+++ b/backend/middleware/exception.py
@@ -81,7 +81,7 @@ class ExceptionLoggingMiddleware:
request (HttpRequest): Request to get API endpoint hit
exception (Exception): Exception that was raised to be logged
"""
- if response.status_code >= 500:
+ if hasattr(response, "status_code") and response.status_code >= 500:
message = (
"{method} {url} {status}\n\n{error}\n\n````{tb}````".format(
method=request.method,