slightly more informative error messages

This commit is contained in:
Ralf Jung 2016-02-07 21:10:27 +01:00
parent 3311042f60
commit 1a85298cc0
2 changed files with 4 additions and 4 deletions

View file

@ -35,7 +35,7 @@ if __name__ == "__main__":
# find the repository we are dealing with
reponame = find_repo_by_directory(repos, os.getcwd())
if reponame is None or reponame not in repos:
raise Exception("Unknown repository.")
raise Exception("Unknown repository {}.".format(reponame))
# now sync this repository
repo = repos[reponame]
@ -50,5 +50,5 @@ if __name__ == "__main__":
if repo is not None:
repo.mail_owner("There was a problem running the git-mirror git hook:\n\n{}".format(traceback.format_exc()))
# do not print all the details
sys.stderr.write("We have a problem:\n{}".format('\n'.join(traceback.format_exception_only(type(e), e))))
sys.stderr.write("git-mirror: We have a problem:\n{}".format('\n'.join(traceback.format_exception_only(type(e), e))))

View file

@ -51,7 +51,7 @@ if __name__ == "__main__":
githubEvent = sys.argv[2]
githubSignature = sys.argv[3]
if reponame not in repos:
raise Exception("Repository missing or not found.")
raise Exception("Repository {} missing or not found.".format(reponame))
repo = repos[reponame]
# now sync this repository
@ -91,4 +91,4 @@ if __name__ == "__main__":
print("Status: 500 Internal Server Error")
print("Content-Type: text/plain")
print()
print("We have a problem:\n{}".format('\n'.join(traceback.format_exception_only(type(e), e))))
print("git-mirror: We have a problem:\n{}".format('\n'.join(traceback.format_exception_only(type(e), e))))