diff --git a/src/plugins/javascript/weechat-js-v8.cpp b/src/plugins/javascript/weechat-js-v8.cpp index caeaafee8..6966af13e 100644 --- a/src/plugins/javascript/weechat-js-v8.cpp +++ b/src/plugins/javascript/weechat-js-v8.cpp @@ -32,6 +32,14 @@ extern "C" #include "weechat-js.h" #include "weechat-js-v8.h" +#define PRINT_EXCEPTION \ + Local exception = trycatch.Exception(); \ + String::Utf8Value str_exception(exception); \ + weechat_printf (NULL, \ + weechat_gettext ("%s%s: exception: %s"), \ + weechat_prefix ("error"), JS_PLUGIN_NAME, \ + *str_exception); + using namespace v8; @@ -84,11 +92,26 @@ WeechatJsV8::load(const char *source) bool WeechatJsV8::execScript() { + v8::TryCatch trycatch; + this->context = Context::New(NULL, this->global); Context::Scope context_scope(this->context); Handle