Page MenuHomePhabricator

API:Block invalid page restriction should return warning rather than fatal error
Open, Needs TriagePublicBUG REPORT

Description

What is the problem?

If I use the API to block a from a non-existent page, the API returns a fatal error which blocks completion of the request.

We should do the same thing we do for invalid namespaces: just return a warning but otherwise complete the request.

Steps to reproduce problem
  1. Submit a request like: https://en.wikipedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=block&format=json&user=Drwpb&allowusertalk=1&partial=1&pagerestrictions=nonexistentpage%7CPillars%20of%20Eternity

Expected behavior: Request is successful (block is created) but some sort of warning like {'warnings': {'block': {'*': 'Unrecognized value for parameter "pagerestrictions": nonexistentpage'}}...
Observed behavior: {"error": {"code": "cant-block-nonexistent-page"...

Environment

Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.37.0-alpha (5d4d08b) 09:09, 11 May 2021