+class JsonErrorRequestExecutor(http.server.HttpServerRequestExecutor):
+ """Custom Request Executor class that formats HTTP errors in JSON.
+
+ """
+ error_content_type = "application/json"
+
+ def _FormatErrorMessage(self, values):
+ """Formats the body of an error message.
+
+ @type values: dict
+ @param values: dictionary with keys code, message and explain.
+ @rtype: string
+ @return: the body of the message
+
+ """
+ return serializer.DumpJson(values, indent=True)
+
+