jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/357120 )
Change subject: [IMPR] Make pywikibot.Error more precise ......................................................................
[IMPR] Make pywikibot.Error more precise
- OptionHandler.getOption raises pywikibot.Error if the given option is not given in availableOptions. OptionHandler is not used by BaseBot class only but also by some generator classes. Make the error message more precise.
Bug: T166982 Change-Id: I011c5d928dba19c7c8f355be19864c56532e52e2 --- M pywikibot/bot.py 1 file changed, 3 insertions(+), 1 deletion(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index f78be24..191aaeb 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -1180,11 +1180,13 @@ Get the current value of an option.
@param option: key defined in OptionHandler.availableOptions + @raise Error: No valid option is given with option parameter """ try: return self.options.get(option, self.availableOptions[option]) except KeyError: - raise pywikibot.Error(u'%s is not a valid bot option.' % option) + raise pywikibot.Error("'{0}' is not a valid option for {1}." + .format(option, self.__class__.__name__))
class BaseBot(OptionHandler):
pywikibot-commits@lists.wikimedia.org