Provide consistent error formatting for RSS/Atom feeds
Open, NormalPublic

Description

Example:

If I set $wgFeed=false and try to access:

http://tools.wikimedia.pl/~saper/y/api.php?hidebots=1&days=7&limit=50&action=feedrecentchanges&feedformat=rss

I get:

`
  HTTP/1.1 200 OK
  Date: Wed, 21 Oct 2015 12:46:14 GMT
  Server: Apache
  X-Content-Type-Options: nosniff
  MediaWiki-API-Error: feed-unavailable
  X-Frame-Options: DENY
  Content-language: pl,en
  X-UA-Compatible: IE=Edge
  Vary: Accept-Encoding,Cookie
  Expires: Thu, 01 Jan 1970 00:00:00 GMT
  Cache-Control: private, must-revalidate, max-age=0
  Content-Length: 4090
  Connection: close
  Content-Type: text/html; charset=UTF-8
`

with HTML-ized json response

`{
    "error": {
        "code": "feed-unavailable",
        "info": "Syndication feeds are not available",
        "*": "See http://tools.wikimedia.pl/~saper/y/api.php for API usage"
    }
}`

But when I try to access watchlist feed:

http://tools.wikimedia.pl/~saper/y/api.php?action=feedwatchlist&allrev=1&wlowner=WikiAdmin&wltoken=0daccf797b431d3151e6026f2e066d8cb709fad8&feedformat=rss

I get

`
  HTTP/1.1 200 OK
  Date: Wed, 21 Oct 2015 12:48:38 GMT
  Server: Apache
  X-Content-Type-Options: nosniff
  Vary: Accept-Encoding,Cookie
  Expires: Thu, 01 Jan 1970 00:00:00 GMT
  Cache-Control: private, must-revalidate, max-age=0
  Content-Length: 613
  Connection: close
  Content-Type: application/xml; charset=UTF-8
  Content-Language: pl

`

with an RSS-formatted item with an error message.

I think we should send a proper HTTP error code (403 or something like that) and the XML message that RSS readers might interpret.

saper created this task.Oct 21 2015, 12:50 PM
saper updated the task description. (Show Details)
saper raised the priority of this task from to Normal.
saper added a project: MediaWiki-API.
saper added subscribers: saper, Aklapper, mgrabovsky and 6 others.
Anomie added a subscriber: Anomie.

The main problem is that none of the feed formats has any method for actually reporting errors. You either return something that's not in the feed format or you make some sort of bogus feed-item.

My proposal would be to return application/xml with a bogus feed-item (as http://tools.wikimedia.pl/~saper/y/api.php?action=feedwatchlist&allrev=1&wlowner=WikiAdmin&wltoken=0daccf797b431d3151e6026f2e066d8cb709fad8&feedformat=rss is doing) and an HTTP 4xx result code.