Permalink
Browse files

Exception handling

- Warn on pywikibot.IsNotRedirectPage, ValueError
- Error with traceback otherwise
  • Loading branch information...
JJMC89 committed Feb 11, 2017
1 parent 0c06437 commit 561cfc66828cff3473bbfa67dadf294d1eb29fbf
Showing with 6 additions and 3 deletions.
  1. +6 −3 enwiki/bsicons-replacer.py
@@ -251,11 +251,14 @@ def main(*args):
if not (page.isRedirectPage() and
isinstance(page, pywikibot.FilePage)):
continue
targetPage = page.getRedirectTarget()
# Target must be a file.
try:
targetFile = pywikibot.FilePage(targetPage)
except:
targetFile = pywikibot.FilePage(page.getRedirectTarget())
except (pywikibot.IsNotRedirectPage, ValueError) as e:
pywikibot.warning(e)
continue
except Exception as e:
pywikibot.exception(e, tb=True)
continue
# Target must be a BSicon.
if not targetFile.title(underscore=True,

0 comments on commit 561cfc6

Please sign in to comment.