From 6c45051420cff79da3493a27ebc41eacac256332 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 23 Jan 2013 20:03:51 -0500 Subject: [PATCH] feed: Convert missing/extra key errors to InvalidFeedConfig This way we get the message and not a full traceback, to avoid scaring users who aren't familiar with Python tracebacks. Theres not much information to go on in the new message, but if you crank up the verbosity, you get: $ PYTHONPATH=. ./r2e -c conf -d data -VVV list load feed configuration from ['conf'] loaded configuration from ['conf'] load feed data from data extra configuration key: use_8bit which seems good enough for me. Reported-by: Dmitry Bogatov Signed-off-by: W. Trevor King --- rss2email/feed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rss2email/feed.py b/rss2email/feed.py index 3621a0b..776d115 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -246,10 +246,14 @@ class Feed (object): for key in expected: if (key not in keys and key not in self._non_default_configured_attributes): - raise ValueError('missing key: {}'.format(key)) + raise _error.InvalidFeedConfig( + setting=key, feed=self, + message='missing configuration key: {}'.format(key)) for key in keys: if key not in expected: - raise ValueError('extra key: {}'.format(key)) + raise _error.InvalidFeedConfig( + setting=key, feed=self, + message='extra configuration key: {}'.format(key)) data = dict( (self._configured_attribute_inverse_translations[k], self._get_configured_attribute_value( -- 2.26.2