Evad37 created this task. Evad37 added projects: Wikidata, MediaWiki-extensions-WikibaseClient, MediaWiki-extensions-Scribunto. Herald added a subscriber: Aklapper. |
TASK DESCRIPTION
In Lua, mw.wikibase.getEntity(id) will return a entity object if "id" is a valid Wikidata entity id, e.g. 'Q42'. However, if the id isn't valid (e.g. 'Q42000000000000000000000000000') it results in a big red Lua error message "The ID entered is unknown to the system. Please use a valid entity ID." This happens even if pcall() or xpcall() is used.
Actual results/demonstartion: See mw:Extension talk:Wikibase Client/Lua ยง testing for a valid QID ? (permalink to lua code in Module:Sandbox)
Expected results: One or more of the following:
- mw.wikibase.getEntity(invalid_id) retuns nil
- pcall() and/or xpcall() catch the error, and behave as one would expect
- another function, perhaps named mw.wikibase.checkEntity(id), that returns true if the id is valid, or false if the id is invalid
- some other way of determining validity without actually throwing an error
TASK DETAIL
EMAIL PREFERENCES
To: Evad37
Cc: Evad37, Aklapper, D3r1ck01, Izno, Wikidata-bugs, aude, Dinoguy1000, jayvdb, MrStradivarius, Anomie, Jackmcbarn, Mbch331
Cc: Evad37, Aklapper, D3r1ck01, Izno, Wikidata-bugs, aude, Dinoguy1000, jayvdb, MrStradivarius, Anomie, Jackmcbarn, Mbch331
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs