Clarify common 500 errors

This commit is contained in:
Brendan Reilly
2021-07-14 13:58:29 -04:00
parent 889a20990f
commit 39add4382c
5 changed files with 10 additions and 8 deletions

View File

@@ -362,7 +362,7 @@ class KojiContentGenerator(object):
ret["filename"] = mmd_filename
ret["filesize"] = len(raw_data)
ret["checksum"] = hashlib.md5(raw_data).hexdigest()
except IOError:
except IOError as e:
if arch == "src":
# This might happen in case the Module is submitted directly
# using the yaml without SCM URL. This should never happen
@@ -371,7 +371,7 @@ class KojiContentGenerator(object):
log.warning("No modulemd.src.txt found.")
return
else:
raise
raise RuntimeError("Could not read %s: %s" % (mmd_path, e))
components = []
if arch in ["noarch", "src"]:
@@ -878,7 +878,7 @@ class KojiContentGenerator(object):
build_info = session.CGImport(metadata, serverdir)
except koji.GenericError as e:
if "Build already exists" not in str(e):
raise
raise RuntimeError("Build import failed: %s" % e)
log.warning("Failed to import content generator")
build_info = None
if conf.koji_cg_tag_build:

View File

@@ -330,7 +330,7 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
state=BUILD_STATES["failed"],
state_reason=reason, failure_type="user")
db_session.commit()
raise
raise RuntimeError("Failed to gather buildroot groups from SCM.")
return groups
@abstractmethod

View File

@@ -48,7 +48,9 @@ def publish(topic, msg, conf, service):
return rv
except Exception:
messaging_tx_failed_counter.inc()
raise
raise RuntimeError(
"Unable to send message to backend %r" % conf.messaging
)
def _fedmsg_publish(topic, msg, conf, service):

View File

@@ -226,7 +226,7 @@ class SCM(object):
"checkout: The requested commit hash was not found within the repository. "
"Perhaps you forgot to push. The original message was: %s" % str(e)
)
raise
raise RuntimeError("Unable to checkout module from SCM: %s" % e)
timestamp = SCM._run(["git", "show", "-s", "--format=%ct"], chdir=self.sourcedir)[1]
self.version = provide_module_stream_version_from_timestamp(timestamp=timestamp)

View File

@@ -182,10 +182,10 @@ def _get_default_modules(stream, default_modules_scm_url):
scm_obj.checkout_ref(conf.rawhide_branch)
else:
# If it's not a rawhide build, then the branch should have existed
raise
raise RuntimeError("Branch %s does not exist" % stream)
else:
# If it's not a rawhide build, then the branch should have existed
raise
raise RuntimeError("Branch %s does not exist" % stream)
idx = Modulemd.ModuleIndex.new()
idx.update_from_defaults_directory(