In some cases, Wikibase editing can return multiple error messages in one go:
{
"error": {
"code": "failed-save",
"info": "The save has failed.",
"messages": [
{
"name": "wikibase-api-failed-save",
"parameters": [],
"html": {
"*": "The save has failed."
}
},
{
"name": "spam-blacklisted-link",
"parameters": [
{
"list": [
"tinyurl.com/auniresc"
],
"type": "text"
}
],
"html": {
"*": "The text you wanted to publish was blocked by the spam filter.\nThis is probably caused by a link to a forbidden external site.\nThe following text is what triggered our spam filter: tinyurl.com/auniresc"
}
}
],
"*": "See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
},
"servedby": "mw-api-ext.eqiad.main-79f56d66b6-6hwm5"
}
In this case, WDTK ignores the entire message part, resulting in an error message that just contains
"code": "failed-save",
"info": "The save has failed.",
which is not very informative. It would be good to expose the inner part of the message too, which mentions the spam blacklist.
The same structure can be found in our own wdtk-wikibaseapi/src/test/resources, although the message there does not bring much additional info:
{
"servedby": "mw1147",
"error": {
"code": "no-such-entity",
"info": "Could not find such an entity (Invalid id: Q0)",
"messages": [
{
"name": "wikibase-api-no-such-entity",
"parameters": [],
"html": {
"*": "Could not find such an entity"
}
}
],
"*": "See https://www.wikidata.org/w/api.php for API usage"
}
}
I couldn't deduce from the API documentation if there is always a messages element, along with code and info? Or if sometimes there is a messages element, depending on circumstances.
In some cases, Wikibase editing can return multiple error messages in one go:
In this case, WDTK ignores the entire
message
part, resulting in an error message that just containswhich is not very informative. It would be good to expose the inner part of the message too, which mentions the spam blacklist.
The same structure can be found in our own
wdtk-wikibaseapi/src/test/resources
, although the message there does not bring much additional info: