An error occurred in processing the request, i.e. an exception was thrown. :type data: A JSON-serializable object :param data: A generic container for any other information about the error, i.e. the conditions that caused the error, stack traces, etc
(self, message, data=None, code=None)
| 84 | self.finish() |
| 85 | |
| 86 | def error(self, message, data=None, code=None): |
| 87 | """An error occurred in processing the request, i.e. an exception was |
| 88 | thrown. |
| 89 | |
| 90 | :type data: A JSON-serializable object |
| 91 | :param data: A generic container for any other information about the |
| 92 | error, i.e. the conditions that caused the error, |
| 93 | stack traces, etc. |
| 94 | :type message: A JSON-serializable object |
| 95 | :param message: A meaningful, end-user-readable (or at the least |
| 96 | log-worthy) message, explaining what went wrong |
| 97 | :type code: int |
| 98 | :param code: A numeric code corresponding to the error, if applicable |
| 99 | """ |
| 100 | result = {"status": "error", "message": message} |
| 101 | if data: |
| 102 | result["data"] = data |
| 103 | if code: |
| 104 | result["code"] = code |
| 105 | self.write(result) |
| 106 | self.finish() |
| 107 | |
| 108 | def write_error(self, status_code, **kwargs): |
| 109 | """Override of RequestHandler.write_error |
no test coverage detected