Last modified: 2014-11-09 20:57:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64261, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62261 - Throw specific error instead of generic APIError if claim target is deleted
Throw specific error instead of generic APIError if claim target is deleted
Status: NEW
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
core-(2.0)
All All
: High minor
: ---
Assigned To: John Mark Vandenberg
:
Depends on:
Blocks: pwb20
  Show dependency treegraph
 
Reported: 2014-03-05 16:34 UTC by FelixReimann
Modified: 2014-11-09 20:57 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description FelixReimann 2014-03-05 16:34:05 UTC
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')
c.addTarget(target)
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

pywikibot.data.api.APIError: 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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links