jenkins-bot submitted this change.
Make exception about missing mediainfo more friendly
Before throwing, re-use the pageid of the file to avoid
exception saying "Entity '-1' ..."
Also don't show the KeyError traceback.
Change-Id: I1a130419477960856b6f976762a128d100eb43a6
---
M pywikibot/page/_wikibase.py
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 5141e00..7f098f8 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -433,8 +433,10 @@
data = self.file.latest_revision.slots['mediainfo']['*']
except NoPageError as exc:
raise NoWikibaseEntityError(self) from exc
- except KeyError as exc:
- raise NoWikibaseEntityError(self) from exc
+ except KeyError:
+ # reuse the reserved ID for better message
+ self.id = 'M' + str(self.file.pageid)
+ raise NoWikibaseEntityError(self) from None
self._content = jsonlib.loads(data)
self.id = self._content['id']
To view, visit change 965058. To unsubscribe, or for help writing mail filters, visit settings.