Skip to content

Commit c0a7cb3

Browse files
committed
Proxy authentication exception catch reworked
1 parent 6858bab commit c0a7cb3

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pulpcore/download/http.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async def download_wrapper():
272272
e.message,
273273
)
274274
)
275-
raise e
275+
raise ProxyAuthenticationRequiredError(self.proxy)
276276

277277
return await download_wrapper()
278278

@@ -301,8 +301,6 @@ async def _run(self, extra_data=None):
301301
await response.release()
302302
except aiohttp.ClientConnectorDNSError:
303303
raise DnsDomainNameException(self.url)
304-
except aiohttp.ClientHttpProxyError:
305-
raise ProxyAuthenticationRequiredError(self.proxy)
306304
if self._close_session_on_finalize:
307305
await self.session.close()
308306
return to_return

pulpcore/tasking/tasks.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ def _execute_task(task):
8282
except Exception:
8383
exc_type, exc, tb = sys.exc_info()
8484
log_task_failed(task, exc_type, exc, tb, domain)
85-
# Generic exception for user
86-
safe_exc = Exception("An internal error occured.")
85+
# Generic exception for user (temporarily including debug info)
86+
safe_exc = Exception(
87+
f"An internal error occured. "
88+
f"[DEBUG: {exc_type.__name__}: {str(exc)}]"
89+
)
8790
task.set_failed(safe_exc)
8891
send_task_notification(task)
8992
else:
@@ -114,8 +117,11 @@ async def _aexecute_task(task):
114117
except Exception:
115118
exc_type, exc, tb = sys.exc_info()
116119
log_task_failed(task, exc_type, exc, tb, domain)
117-
# Generic exception for user
118-
safe_exc = Exception("An internal error occured.")
120+
# Generic exception for user (temporarily including debug info)
121+
safe_exc = Exception(
122+
f"An internal error occured. "
123+
f"[DEBUG: {exc_type.__name__}: {str(exc)}]"
124+
)
119125
await sync_to_async(task.set_failed)(safe_exc)
120126
send_task_notification(task)
121127
else:

0 commit comments

Comments
 (0)