diff options
| author | Frederick Muriuki Muriithi <fredmanglis@gmail.com> | 2026-09-29 11:39:18 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi <fredmanglis@gmail.com> | 2026-09-29 11:39:18 -0500 |
| commit | e06c50a97b17c3d80af6ed6874531f2c79e1b785 (patch) | |
| tree | cebe068b9e7db89b80fb50793dd9f1c788b8cace /gn_auth/errors/common.py | |
| parent | 7ae019865d6b7cfd39aeddf14109ece29598bb78 (diff) | |
| download | gn-auth-e06c50a97b17c3d80af6ed6874531f2c79e1b785.tar.gz | |
Diffstat (limited to 'gn_auth/errors/common.py')
| -rw-r--r-- | gn_auth/errors/common.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gn_auth/errors/common.py b/gn_auth/errors/common.py index 8dc0373..35e4d21 100644 --- a/gn_auth/errors/common.py +++ b/gn_auth/errors/common.py @@ -30,10 +30,11 @@ def build_handler(description: str) -> Callable[[Exception], Response]: """Generic utility to build error handlers.""" def __handler__(exc: Exception) -> Response: """Handle the exception as appropriate for requests of different mimetypes.""" + logger.debug("EXCEPTION: %s", exc, exc_info=True) error = (exc.name if hasattr(exc, "name") else exc.__class__.__name__) status_code = __status_code__(exc) - content_type = request.content_type - if bool(content_type) and content_type.lower() == "application/json": + if ("application/json" in request.headers.get("Accept", "") + or "application/json" in request.headers.get("Content-Type", "")): return make_response(( add_trace( exc, |
