From 4f5ee75a8eaa9eb4d37c69f2b9efb4a56359b02d Mon Sep 17 00:00:00 2001 From: Peter Mosmans Date: Wed, 7 Jun 2017 19:44:24 +1000 Subject: [PATCH] Catch gitlab exception properly --- chatops/python/gitlab-to-pentext.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chatops/python/gitlab-to-pentext.py b/chatops/python/gitlab-to-pentext.py index 26ef11c..7710b68 100644 --- a/chatops/python/gitlab-to-pentext.py +++ b/chatops/python/gitlab-to-pentext.py @@ -202,11 +202,14 @@ def list_issues(gitserver, options): """ Lists all issues for options['issues'] """ - for issue in gitserver.project_issues.list(project_id=options['issues'], - per_page=999): - if issue.state == 'closed' and not options['closed']: - continue - add_item(issue, options) + try: + for issue in gitserver.project_issues.list(project_id=options['issues'], + per_page=999): + if issue.state == 'closed' and not options['closed']: + continue + add_item(issue, options) + except gitlab.exceptions.GitlabListError as exception: + print_error('Could not access items ({0})'.format(exception)) def list_projects(gitserver):