Page MenuHomePhabricator

Set up documentation for errors, and link to it in problem URLs instead of old restbase.org default
Closed, ResolvedPublic

Description

Our error responses follow http://tools.ietf.org/html/draft-nottingham-http-problem-07, and contain a type field containing a URL. Normally, this URL is supposed to provide detailed information about the error, possibly with things to check when encountering it.

Currently, we return URLs pointing to restbase.org, a domain we don't use any more. We should update it to point to actual error descriptions.

This brings up the question of where to host those. A few options:

MediaWiki.org, possibly using /wiki/RESTBase/error/<type>

  • PRO: Familiar to the community
  • PRO: Easy to edit
  • CON: Easy to edit, will need to keep an eye on edits.

Markdown on github

  • PRO: Easy to integrate with our regular code review flow; low risk of vandalism.
  • CON: Not as obvious for the community.
  • CON: Harder to edit.

Event Timeline

MediaWiki.org, possibly using /wiki/RESTBase/error/<type>

PRO: Familiar to the community
PRO: Easy to edit
CON: Easy to edit, will need to keep an eye on edits.

+1

I don't think we should use outside resources to host canonical documentation like this, and believe (as I hope most in our organization do), that the PROs of a globally editable wiki outweigh the CONs.

MediaWiki.org, possibly using /wiki/RESTBase/error/<type>

PRO: Familiar to the community
PRO: Easy to edit
CON: Easy to edit, will need to keep an eye on edits.

+1

I don't think we should use outside resources to host canonical documentation like this, and believe (as I hope most in our organization do), that the PROs of a globally editable wiki outweigh the CONs.

+1

The question is whether the type prefix should be a configurable parameter in HyperSwitch config, or should we require users to use full URI strings as type of an error.

With the former each HyperSwitch user will have to set up a complete set pages for all errors, whether with the latter we can set up https://mediawiki.org/wiki/hyperswitch/errors/* for general errors like parameter validation errors, not found, etc. and the set up RESTBase specific errors for example under https://mediawiki.org/wiki/restbase/errors/*.

I personally think the latter is a better approach.

@Pchelolo, I think we can combine the two options:

Here's the list of error types we produce right now form HyperSwitch and RESTBase This is a pretty long list, so we need to make an effort to standardise this before creating pages on mediawiki.

  • unauthorized
  • invalid_request, bad_request
  • forbidden
  • request_recursion_depth_exceeded
  • access_denied#sys
  • empty_response
  • internal_error, server_error
  • not_found, not_found#route, not_found#page_revisions
  • key_value/invalid_tid, key_rev_value/invalid_tid, key_rev_large_value/invalid_tid, bucket/invalid_tid
  • key_value/invalid_revision, key_rev_value/invalid_revision, key_rev_large_value/invalid_revision, bucket/invalid_revision
  • invalid_paging_token
  • access_denied#edit, access_denied#revision
  • conflict
  • too_large
  • rate_exceeded
  • not_supported
  • events
  • invalidRevision
  • rerenders_disabled
  • revision#conflict

I almost wonder if we should include the response status in the error name (ex: /wiki/HyperSwitch/errors/404_not_found). Doing so would provide a bit more context on the error.

I've created a sample page for one of the errors: https://www.mediawiki.org/wiki/HyperSwitch/errors/bad_request All other error pages will follow the same structure, so please have a look and tell me what you think about it before I continue creating similar pages.

The error pages were set up on mediawiki: https://www.mediawiki.org/wiki/HyperSwitch/errors

All the thrown errors are updated to match URIs of documentation in the following PRs:
https://github.com/wikimedia/hyperswitch/pull/30
https://github.com/wikimedia/restbase/pull/574