Page MenuHomePhabricator

Flow: 404 API error not reported to user, instead causes JS errors
Closed, ResolvedPublic

Description

While trying to reproduce bug 68472 I triggered network errors:

  1. View a Flow board on local MW server.
  2. Open browser
  3. On server rename api.php to api_BROKEN.php
  4. Click Summrize topic, or click Reply and then click [Reply], etc.

Result: nothing is reported to the user despite the api response being 404 Not Found. The console reports a JS error

TypeError: result.error is undefined

from
if ( result.error.prev_revision ) in apiHandlers[ handlerName ] fail().

In this failure case, there's no result.error , hence the JS error. Even if avoided, Flow displays "undefioned" in its pink errorbox because there's nothing in result.error.info; it seems that if there's a network error the failure information is in result.exception ("Not found") and result.textStatus ("error"). (It sucks that different levels of API failure put information in different pieces of the result object.)


Version: master
Severity: minor

Details

Reference
bz68474

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:27 AM
bzimport set Reference to bz68474.

https://gerrit.wikimedia.org/r/#/c/148691/ avoids the JS failure, so I lowered the priority

  • It still assumes if there's a result.error then result.error.info will contain a text string.
  • It assumes any API failure is an HTTP error.

I have a patch that's addresses these.

Change 148870 had a related patch set uploaded by Spage:
More robust API error reporting

https://gerrit.wikimedia.org/r/148870

Change 148870 merged by jenkins-bot:
More robust API error reporting

https://gerrit.wikimedia.org/r/148870

I just got a 503 error on beta labs, and it displayed '"flow-error-http' ("An error occurred while contacting the server."), so fixed.