Skip to content

Commit

Permalink
Give a reasonable error for unreachable wiki url
Browse files Browse the repository at this point in the history
Prevent traceback when wiki server is not reachable.
Fix BZ#2118329.
  • Loading branch information
psss committed Jul 11, 2023
1 parent a52e6df commit 101d208
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions did/plugins/wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import xmlrpc.client

from did.base import Config, ConfigError
from did.base import Config, ConfigError, ReportError
from did.stats import Stats, StatsGroup
from did.utils import item

Expand All @@ -41,8 +41,13 @@ def __init__(self, option, name=None, parent=None, url=None, api=None):
Stats.__init__(self, option, name, parent)

def fetch(self):
for change in self.proxy.getRecentChanges(
self.options.since.datetime):
try:
changes = self.proxy.getRecentChanges(self.options.since.datetime)
except (xmlrpc.client.Error, OSError) as error:
raise ReportError(
f"Unable to fetch wiki changes from '{self.url}' "
f"because of '{error}'.")
for change in changes:
if (change["author"] == self.user.login
and change["lastModified"] < self.options.until.date):
self.changes += 1
Expand Down

0 comments on commit 101d208

Please sign in to comment.