0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-01-03 10:21:51 +00:00

Handle exceptions throw from module loader callback.

This commit is contained in:
Simon Best 2013-03-24 22:53:31 +00:00
parent ff34a2ddda
commit cd20140774

View File

@ -25,6 +25,7 @@
extern "C" {
#include "php.h"
#include "zend_exceptions.h"
}
#include "php_v8js_macros.h"
@ -285,6 +286,13 @@ V8JS_METHOD(require)
return v8::ThrowException(v8::String::New("Module loader callback failed"));
}
// Check if an exception was thrown
if (EG(exception)) {
// Clear the PHP exception and throw it in V8 instead
zend_clear_exception(TSRMLS_CC);
return v8::ThrowException(v8::String::New("Module loader callback exception 456"));
}
// Convert the return value to string
if (Z_TYPE(module_code) != IS_STRING) {
convert_to_string(&module_code);