Skip to content

Commit a07ffae

Browse files
committed
oidc-exchange: reflow
Signed-off-by: William Woodruff <[email protected]>
1 parent 267202b commit a07ffae

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

oidc-exchange.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,28 @@ def get_normalized_input(name: str) -> str | None:
103103
message = "Token request failed"
104104
try:
105105
error_payload = mint_token_resp.json()
106-
reasons = "\n".join(
107-
f"* `{error['code']}`: {error['description']}"
108-
for error in error_payload["errors"]
109-
)
110-
message = f"""
111-
{message}: the server refused the request for the following reasons:
112-
113-
{reasons}
114-
"""
115106
except requests.JSONDecodeError:
116107
# Token exchange failure normally produces a JSON error response, but
117108
# we might have hit a server error instead.
118-
message = f"""
119-
{message}: the index produced an unexpected {mint_token_resp.status_code} response.
109+
message = dedent(
110+
f"""
111+
{message}: the index produced an unexpected {mint_token_resp.status_code} response.
120112
121-
This strongly suggests a server configuration or downtime issue; wait
122-
a few minutes and try again.
113+
This strongly suggests a server configuration or downtime issue; wait
114+
a few minutes and try again.
115+
"""
116+
)
117+
die(message)
118+
119+
reasons = "\n".join(
120+
f"* `{error['code']}`: {error['description']}"
121+
for error in error_payload["errors"]
122+
)
123+
124+
message = f"""
125+
{message}: the server refused the request for the following reasons:
126+
127+
{reasons}
123128
"""
124129

125130
die(message)

0 commit comments

Comments
 (0)