From ff76902e661dbea263fc34732b525ac0b5ba79d0 Mon Sep 17 00:00:00 2001
From: Patrick Sunter
Date: Thu, 1 Feb 2018 15:22:40 +1100
Subject: [PATCH] [Fix #17] redmine resolver deal w/ no issue #
Like the other resolvers, the redmine resolver will
now return None if the requested issue isn't found
in the registered redmine project.
---
sphinxcontrib/issuetracker/resolvers.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sphinxcontrib/issuetracker/resolvers.py b/sphinxcontrib/issuetracker/resolvers.py
index 7ddd0d2..894964f 100644
--- a/sphinxcontrib/issuetracker/resolvers.py
+++ b/sphinxcontrib/issuetracker/resolvers.py
@@ -202,6 +202,7 @@ def lookup_jira_issue(app, tracker_config, issue_id):
def lookup_redmine_issue(app, tracker_config, issue_id):
from redmine import Redmine
+ import redmine.exceptions as redmine_exceptions
if not tracker_config.url:
raise ValueError('URL required')
redmine = Redmine(tracker_config.url,
@@ -210,7 +211,11 @@ def lookup_redmine_issue(app, tracker_config, issue_id):
password=app.config.issuetracker_redmine_password,
requests=app.config.issuetracker_redmine_requests)
if redmine:
- issue = redmine.issue.get(issue_id)
+ try:
+ issue = redmine.issue.get(issue_id)
+ except redmine_exceptions.ResourceNotFoundError:
+ # requested issue number not found
+ return None
return Issue(id=issue_id, title=issue.subject,
closed=issue.status is "Closed",
url=issue.url)