make error a bit clearer

This commit is contained in:
Mike McLean 2024-01-04 11:37:25 -05:00 committed by Yu Ming Zhu
parent a4b4aedba8
commit 71bead5955

View file

@ -6119,8 +6119,11 @@ def new_build(data, strict=False):
# check for existing build
old_binfo = get_build(data)
if old_binfo:
if strict or data['draft']:
raise koji.GenericError(f'Existing build found: {old_binfo}')
old_str = '%(nvr)s (id=%(id)s)' % old_binfo
if data['draft']:
raise koji.GenericError(f'Target build already exists: {old_str}')
elif strict:
raise koji.GenericError(f'Existing build found: {old_str}')
recycle_build(old_binfo, data)
# Raises exception if there is a problem
return old_binfo['id']