Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError: exceptions must derive from BaseException #329

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix WSGIAppError rewrapping
Corentin ARNOULD committed Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature.
JBBianchi Jean-Baptiste Bianchi
commit dbf77dce10744029c3f798fe45a7403bfa3c9413
23 changes: 15 additions & 8 deletions gabbi/case.py
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@
from unittest import result as unitresult
import urllib.parse as urlparse

import wsgi_intercept

from gabbi import __version__
from gabbi import exception
from gabbi.handlers import base
@@ -500,14 +502,19 @@ def _run_request(
if 'user-agent' not in (key.lower() for key in headers):
headers['user-agent'] = "gabbi/%s (Python urllib3)" % __version__

response, content = self.http.request(
url,
method=method,
headers=headers,
body=body,
redirect=redirect,
timeout=timeout,
)
try:
response, content = self.http.request(
url,
method=method,
headers=headers,
body=body,
redirect=redirect,
timeout=timeout,
)
except wsgi_intercept.WSGIAppError as exc:
# Extract and re-raise the wrapped exception.
raise exc.exception_type(exc.exception_value).with_traceback(
exc.traceback) from None

# Set headers and location attributes for follow on requests
self.response = response