File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -100,34 +100,35 @@ def get_normalized_input(name: str) -> str | None:
100
100
)
101
101
102
102
if not mint_token_resp .ok :
103
- message = "Token request failed"
104
103
try :
105
104
error_payload = mint_token_resp .json ()
106
105
except requests .JSONDecodeError :
107
106
# Token exchange failure normally produces a JSON error response, but
108
107
# we might have hit a server error instead.
109
- message = dedent (
110
- f"""
111
- { message } : the index produced an unexpected { mint_token_resp .status_code } response.
112
-
113
- This strongly suggests a server configuration or downtime issue; wait
114
- a few minutes and try again.
115
- """
108
+ die (
109
+ dedent (
110
+ f"""
111
+ Token request failed: the index produced an unexpected { mint_token_resp .status_code } response.
112
+
113
+ This strongly suggests a server configuration or downtime issue; wait
114
+ a few minutes and try again.
115
+ """
116
+ )
116
117
)
117
- die (message )
118
118
119
119
reasons = "\n " .join (
120
120
f"* `{ error ['code' ]} `: { error ['description' ]} "
121
121
for error in error_payload ["errors" ]
122
122
)
123
123
124
- message = f"""
125
- { message } : the server refused the request for the following reasons:
124
+ # NOTE: Can't `dedent(...)` here because `reasons` is newline-delimited.
125
+ die (
126
+ f"""
127
+ Token request failed: the server refused the request for the following reasons:
126
128
127
129
{ reasons }
128
- """
129
-
130
- die (message )
130
+ """
131
+ )
131
132
132
133
mint_token_payload = mint_token_resp .json ()
133
134
pypi_token = mint_token_payload .get ("token" )
You can’t perform that action at this time.
0 commit comments