There is currently no way to expand the payload, but you can set up a status code.
How this is done in endpoints.api_exceptions for error 400 :
import httplib class BadRequestException(ServiceException): """Bad request exception that is mapped to a 400 response.""" http_status = httplib.BAD_REQUEST
Current list (as of 5/8/2013) of status codes supported for errors:
httplib.BAD_REQUEST : 400httplib.UNAUTHORIZED : 401httplib.FORBIDDEN : 403httplib.NOT_FOUND : 404httplib.CONFLICT : 409httplib.GONE : 410httplib.PRECONDITION_FAILED : 412httplib.REQUEST_ENTITY_TOO_LARGE : 413
and these status codes will be mapped to other codes:
httplib.PAYMENT_REQUIRED : 402 displayed on 404httplib.METHOD_NOT_ALLOWED : 405 compared to 501httplib.NOT_ACCEPTABLE : 406 displayed on 404httplib.PROXY_AUTHENTICATION_REQUIRED : 407 maps to 404httplib.REQUEST_TIMEOUT : 408 maps to 503httplib.LENGTH_REQUIRED : 411 maps to 404httplib.REQUEST_URI_TOO_LONG : 414 displayed on 404httplib.UNSUPPORTED_MEDIA_TYPE : 415, mapped to 404httplib.REQUESTED_RANGE_NOT_SATISFIABLE : 416 displayed on 404httplib.EXPECTATION_FAILED : 417 displayed on 404
Also, if your response is a message_types.VoidMessage object, you can send 204 no response to the content ( httplib.NO_CONTENT ).
source share