From 5a0b357f64127b709acfd5c806d4f9f529351a4a Mon Sep 17 00:00:00 2001 From: Lenka Segura Date: Dec 25 2018 09:21:50 +0000 Subject: add logging to cranc.py --- diff --git a/cranc/cranc.py b/cranc/cranc.py index 5f543be..f48c2b8 100644 --- a/cranc/cranc.py +++ b/cranc/cranc.py @@ -10,6 +10,8 @@ from libpagure import libpagure api_token = os.getenv("CRANC_TOKEN") project = "pagure" +_log = logging.getLogger(__name__) + # Creating a Pagure object PAGURE = libpagure.Pagure(pagure_token=api_token, pagure_repository=project) @@ -47,7 +49,10 @@ def filter_pull_requests(status, assignee, author): :param author: filters the author of the requests :return: """ - return PAGURE.list_requests(status=status, assignee=assignee, author=author) + try: + return pagure.list_requests(status=status, assignee=assignee, author=author) + except Exception: + _log.exception("Failed to connect to the server") pr.add_command(pr_list)