See Gerrit patch 770444 for the error response specifications
code is a symbolic category of errors
message is a human readable error message
BDD
WHEN I request GET /entities/items/{item_id} with ID of item that does not exist
THEN I get 404 HTTP response
AND it contains a item-not-found code and a message "Could not find an item with the ID {item_id}"
AND a HTTP header Content-Language set to en
BDD
WHEN I request GET /entities/items/{item_id} with a text which is not an item ID
THEN I get 400 HTTP response
AND it contains a invalid-item-id code and a message "Not a valid item ID: {item_id}"
AND a HTTP header Content-Language set to en
BDD
WHEN I request GET /entities/items/{item_id} with a valid item ID
AND a generic server or database error occurs
THEN I get 500 HTTP response
AND it contains a unexpected-error code and a message "Unexpected Error"
AND a HTTP header Content-Language set to en
Not included in this story
- internationalized/translated error message via Accept-Language HTTP header
Note:
- using the built-in error mechanism from MediaWiki REST API is fine as long as the specification is met