MCPcopy
hub / github.com/owtf/owtf / error

Method error

owtf/api/handlers/base.py:86–106  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 14

rank_pluginMethod · 0.80
process_pluginMethod · 0.80
abort_frameworkFunction · 0.80
get_file_as_listFunction · 0.80
startMethod · 0.80
shell_exec_monitorMethod · 0.80
load_targetsFunction · 0.80
get_aux_targetFunction · 0.80
get_hrt_responseFunction · 0.80
load_worksFunction · 0.80
index.jsFile · 0.80
logger.jsFile · 0.80

Calls 1

writeMethod · 0.95

Tested by

no test coverage detected