Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

fix: Raise exception on error from iam_sign_endpoint - #880

Closed
bgirschig wants to merge 1 commit into
googleapis:mainfrom
bgirschig:patch-1
Closed

fix: Raise exception on error from iam_sign_endpoint#880
bgirschig wants to merge 1 commit into
googleapis:mainfrom
bgirschig:patch-1

Conversation

@bgirschig

Copy link
Copy Markdown

Raise an exception when the sign_bytes function of an impersonated credential gets an error from the iam_sign_endpoint.

(currently, it fails with a KeyError exception)

Raise an exception when the sign_bytes function of an impersonated credential gets an error from the iam_sign_endpoint.

(currently, it fails with a KeyError exception)
@bgirschig
bgirschig requested a review from a team October 1, 2021 11:12
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 1, 2021
response_data = response.json()

if "error" in response:
raise Exception(response_data["error"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception type should be based on the status code from the response (which we ought to be checking before extracting JSON, anyway).

We will also need one or more new tests for the error case.

@arithmetic1728

Copy link
Copy Markdown
Contributor

fixed in #905

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants