PythonMonkey v1.1.1 (dev)
|
Call this function whenever a JS_* function call fails in order to set an appropriate python exception (remember to also return NULL) More...
#include "include/modules/pythonmonkey/pythonmonkey.hh"
#include "include/setSpiderMonkeyException.hh"
#include "include/StrType.hh"
#include "include/DictType.hh"
#include <jsapi.h>
#include <Python.h>
#include <codecvt>
#include <locale>
Functions | |
PyObject * | getExceptionString (JSContext *cx, const JS::ExceptionStack &exceptionStack, bool printStack) |
Convert the given SpiderMonkey exception stack to a Python string. | |
void | setSpiderMonkeyException (JSContext *cx) |
This function sets a python error under the assumption that a JS_* function call has failed. Do not call this function if that is not the case. | |
Call this function whenever a JS_* function call fails in order to set an appropriate python exception (remember to also return NULL)
PyObject * getExceptionString | ( | JSContext * | cx, |
const JS::ExceptionStack & | exceptionStack, | ||
bool | printStack | ||
) |
Convert the given SpiderMonkey exception stack to a Python string.
cx | - pointer to the JS context |
exceptionStack | - reference to the SpiderMonkey exception stack |
printStack | - whether or not to print the JS stack |
the resulting python error string will be in the format: "Error in file <filename>, on line <lineno>: <offending line of code if relevant, nothing if not> <if offending line is present, then a '^' pointing to the relevant token> <spidermonkey error message> Stack Track: <stack trace>"
void setSpiderMonkeyException | ( | JSContext * | cx | ) |
This function sets a python error under the assumption that a JS_* function call has failed. Do not call this function if that is not the case.
cx | - pointer to the JS context |