Page MenuHomePhabricator

Improve error for invalid page name
Open, MediumPublic

Description

If you type an invalid Wikipedia page title into the search box you are presented with an "Oops! Something went wrong" page with the full traceback displayed. We should probably not even take users off the edit page, catching the error and keeping them there with a more helpful error notice.

Event Timeline

Can also happen with pages which have been redirected in the meanwhile:
https://tools.wmflabs.org/oabot/review-edit?edit=00dd02ded2c5f46195a3d8c29aa999b5&name=Sexual+violence+in+the+Democratic+Republic+of+the+Congo%2FMilitia+groups

OAbot
Oops! Something went wrong.
Error:
Invalid page. 
Traceback (most recent call last):
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/data/project/oabot/www/python/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/data/project/oabot/www/python/src/app.py", line 150, in review_one_edit
@app.route('/review-edit')
File "/data/project/oabot/www/python/src/app.py", line 242, in get_one_proposed_edit
File "/data/project/oabot/www/python/src/app.py", line 210, in get_proposed_edits
redirect_re = re.compile(r'#REDIRECT *\[\[(.*)\]\]')
File "./oabot/main.py", line 302, in get_page_over_api
raise ValueError("Invalid page.")
ValueError: Invalid page.

For such cases, the best prevention is having fresh suggestions.