Skip to content

Commit 70389d6

Browse files
committed
Cleaned up some more bits.
1 parent df47400 commit 70389d6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/idpyoidc/client/oauth2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ def parse_request_response(self, service, reqresp, response_body_type='',
229229

230230
try:
231231
err_resp = service.parse_response(reqresp.text, _deser_method)
232-
except FormatError:
232+
except (FormatError, ValueError):
233233
if _deser_method != response_body_type:
234234
try:
235235
err_resp = service.parse_response(reqresp.text,
236236
response_body_type)
237-
except (OidcServiceError, FormatError):
237+
except (OidcServiceError, FormatError, ValueError):
238238
raise OidcServiceError("HTTP ERROR: %s [%s] on %s" % (
239239
reqresp.text, reqresp.status_code, reqresp.url))
240240
else:

src/idpyoidc/client/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def _do_response(self, info, sformat, **kwargs):
501501
raise
502502

503503
if resp is None:
504-
raise TypeError(f'Incorrect message type: {sformat}')
504+
raise ValueError(f'Incorrect message type: {sformat}')
505505
return resp
506506

507507
def parse_response(self, info,

tests/test_client_04_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_parse_response_err(self):
112112
_sign_key = self.service_context.keyjar.get_signing_key()
113113
resp1 = AuthorizationResponse(code="auth_grant", state="state").to_jwt(key=_sign_key,
114114
algorithm="RS256")
115-
with pytest.raises(FormatError):
115+
with pytest.raises(ValueError):
116116
arg = self.service.parse_response(resp1)
117117

118118

0 commit comments

Comments
 (0)