diff --git a/tests/extensions_error.phpt b/tests/extensions_error.phpt index 89118c8..e4f3629 100644 --- a/tests/extensions_error.phpt +++ b/tests/extensions_error.phpt @@ -37,6 +37,8 @@ Exception thrown during bootstrapping Extension or internal compilation error%sin handlebars at line 1. Error installing extension 'handlebars'. -Warning: V8Js::__construct(): Failed to create V8 context. Check that registered extensions do not have errors. in %s on line %d -NULL -===EOF=== +Fatal error: Uncaught V8JsException: Failed to create V8 context. Check that registered extensions do not have errors. in %s%eextensions_error.php:7 +Stack trace: +#0 %s%eextensions_error.php(7): V8Js->__construct() +#1 {main} + thrown in %s%eextensions_error.php on line 7 diff --git a/v8js_class.cc b/v8js_class.cc index 1742807..b13f16c 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -347,7 +347,8 @@ static PHP_METHOD(V8Js, __construct) { exts_count = zend_hash_num_elements(Z_ARRVAL_P(exts_arr)); if (v8js_create_ext_strarr(&exts, exts_count, Z_ARRVAL_P(exts_arr)) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid extensions array passed"); + zend_throw_exception(php_ce_v8js_exception, + "Invalid extensions array passed", 0); return; } } @@ -387,8 +388,9 @@ static PHP_METHOD(V8Js, __construct) /* If extensions have errors, context will be empty. (NOTE: This is V8 stuff, they expect the passed sources to compile :) */ if (context.IsEmpty()) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create V8 context. Check that registered extensions do not have errors."); - ZVAL_NULL(getThis()); + zend_throw_exception(php_ce_v8js_exception, + "Failed to create V8 context. " + "Check that registered extensions do not have errors.", 0); return; }