Skip to content

Commit

Permalink
Improve error handling for Koji
Browse files Browse the repository at this point in the history
Avoid printing stack trace on Koji XMLRPC faults. Log the error and pass
it to the client instead.

JIRA: RHELWF-10505, RHELWF-10400
  • Loading branch information
hluk committed Jan 17, 2024
1 parent 16d88ef commit 1bf0dc9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion greenwave/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ def retrieve_koji_build_target(task_id, koji_url: str):
def _retrieve_koji_build_attributes(nvr: str, koji_url: str):
log.debug('Getting Koji build %r', nvr)
proxy = _koji(koji_url)
build = proxy.getBuild(nvr)

try:
build = proxy.getBuild(nvr)
except xmlrpc_client.Fault as e:
error = f'Failed to get Koji build for "{nvr}": {e}'
log.debug(error)
raise BadGateway(error)

if not build:
raise NotFound(
'Failed to find Koji build for "{}" at "{}"'.format(nvr, koji_url)
Expand Down

0 comments on commit 1bf0dc9

Please sign in to comment.