mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-14 05:49:48 +08:00
Improve error messaging for module submission.
Fixes: https://pagure.io/fm-orchestrator/issue/1098
This commit is contained in:
@@ -333,11 +333,12 @@ class SCM(object):
|
||||
with open(path_to_yaml):
|
||||
return path_to_yaml
|
||||
except IOError:
|
||||
log.error(
|
||||
msg = (
|
||||
"get_module_yaml: The SCM repository doesn't contain a modulemd file. "
|
||||
"Couldn't access: %s" % path_to_yaml
|
||||
)
|
||||
raise UnprocessableEntity("The SCM repository doesn't contain a modulemd file")
|
||||
log.error(msg)
|
||||
raise UnprocessableEntity(msg)
|
||||
|
||||
@staticmethod
|
||||
def is_full_commit_hash(scheme, commit):
|
||||
|
||||
@@ -522,8 +522,9 @@ class SCMHandler(BaseHandler):
|
||||
raise Forbidden("The submitted scmurl %s is not allowed" % url)
|
||||
|
||||
if not get_scm_url_re().match(url):
|
||||
log.error("The submitted scmurl %r is not valid" % url)
|
||||
raise ValidationError("The submitted scmurl %s is not valid" % url)
|
||||
msg = "Expected format is '%s?[module-path]#[revision]'" % url
|
||||
log.error("The submitted scmurl %r is not valid. %s" % (url, msg))
|
||||
raise ValidationError("The submitted scmurl %s is not valid. %s" % (url, msg))
|
||||
|
||||
if not skip_branch and "branch" not in self.data:
|
||||
log.error("Missing branch")
|
||||
|
||||
@@ -1239,7 +1239,9 @@ class TestSubmitBuild:
|
||||
data = json.loads(rv.data)
|
||||
assert data["message"] == (
|
||||
"The submitted scmurl https://src.stg.fedoraproject.org"
|
||||
"/modules/testmodule.git is not valid"
|
||||
"/modules/testmodule.git is not valid. Expected format is "
|
||||
"'https://src.stg.fedoraproject.org/modules/testmodule.git?"
|
||||
"[module-path]#[revision]'"
|
||||
)
|
||||
assert data["status"] == 400
|
||||
assert data["error"] == "Bad Request"
|
||||
|
||||
Reference in New Issue
Block a user