Bug ID: 62261
           Summary: Throw specific error instead of generic APIError if
                    claim target is deleted
           Product: Pywikibot
           Version: core (2.0)
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: Unprioritized
         Component: Wikidata
       Web browser: ---
   Mobile Platform: ---

If adding a claim, two types of errors are thrown in case of a deleted item:

item = pywikibot.ItemPage(repo, "Q726")
target = pywikibot.ItemPage(repo, "Q14854094")
c = pywikibot.Claim(repo, u'P171')
item.addClaim(c) # Error if item or target were deleted

At the last line, you get either

pywikibot.exceptions.NoPage: Page [[wikidata:-1]] doesn't exist.

if item (Q726) has been deleted or invalid-snak-value: Q14854094 not found

if the target (Q14854094) has been deleted.

It would be great, if for the latter a specific "InvalidValueError" or similar
would be thrown. Then, the error could be caught and handled specifically
without the need to parse the (possibly changing) API error message itself.

You are receiving this mail because:
You are on the CC list for the bug.
Wikibugs-l mailing list

Reply via email to