As an API user, I want to be able to make mistakes without crashing anything server-side, in order to experiment with the API easily.
Problem:
If you call the PropertySuggester API with an invalid entity ID, e. g. by accident in the API sandbox, an uncaught exception is thrown
Example:
{ "error": { "code": "internal_api_error_InvalidArgumentException", "info": "$idSerialization must match /^Q[1-9]\\d{0,9}\\z/i", "errorclass": "InvalidArgumentException", "*": "See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes." }, "servedby": "mw1290" }
BDD
WHEN a wbgetsuggestions request with an invalid ID is made
THEN a proper error is returned
Acceptance Criteria 🏕️🌟:
- Users should not see exceptions for bad input parameters or missing input parameters. Users should see nice error messages.
- The case of an invalid ID is covered (as in description)
- The case of no entity param is covered (as in T229319#7180441)
- Keep an eye out for (and fix if you find) other similar cases in the api parameter validation code)