jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/902692 )

Change subject: [IMPR] Raise NoPageError when deleting a missing Page
......................................................................

[IMPR] Raise NoPageError when deleting a missing Page

Bug: T332924
Change-Id: I5c8d5a424fd1cb5db1aeeb7a50eac2fb0552dd13
---
M pywikibot/site/_apisite.py
1 file changed, 14 insertions(+), 1 deletion(-)

Approvals:
  BinĂ¡ris: Looks good to me, approved
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 01ee1ac..cca3beb 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2371,7 +2371,6 @@
         'cantundelete': 'Could not undelete [[{title}]]. '
                         'Revision may not exist or was already undeleted.',
         'nodeleteablefile': 'No such old version of file',
-        'missingtitle': "[[{title}]] doesn't exist.",
     }  # other errors shouldn't occur because of pre-submission checks

     @need_right('delete')
@@ -2443,11 +2442,15 @@
         try:
             req.submit()
         except APIError as err:
+            if err.code == 'missingtitle':
+                raise NoPageError(page) from None
+
             errdata = {
                 'site': self,
                 'title': title,
                 'user': self.user(),
             }
+
             if err.code in self._dl_errors:
                 raise Error(
                     self._dl_errors[err.code].format_map(errdata)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/902692
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5c8d5a424fd1cb5db1aeeb7a50eac2fb0552dd13
Gerrit-Change-Number: 902692
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: BinĂ¡ris <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to