commonjs_exception_001.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Test V8Js::setModuleLoader : Forward exceptions
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $JS = <<< EOT
  8. var foo = require("./test");
  9. EOT;
  10. $v8 = new V8Js();
  11. $v8->setModuleLoader(function($module) {
  12. throw new Exception('some exception');
  13. });
  14. $v8->executeString($JS, 'module.js', V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS);
  15. ?>
  16. ===EOF===
  17. --EXPECTF--
  18. Fatal error: Uncaught Exception: some exception in %s%ecommonjs_exception_001.php:9
  19. Stack trace:
  20. #0 [internal function]: {closure}('test')
  21. #1 %s%ecommonjs_exception_001.php(12): V8Js->executeString('var foo = requi...', 'module.js', 4)
  22. #2 {main}
  23. Next V8JsScriptException: module.js:1: Exception: some exception in %s%ecommonjs_exception_001.php:9
  24. Stack trace:
  25. #0 [internal function]: {closure}('test')
  26. #1 %s%ecommonjs_exception_001.php(12): V8Js->executeString('var foo = requi...', 'module.js', 4)
  27. #2 {main} in %s%ecommonjs_exception_001.php:12
  28. Stack trace:
  29. #0 %s%ecommonjs_exception_001.php(12): V8Js->executeString('var foo = requi...', 'module.js', 4)
  30. #1 {main}
  31. thrown in %s%ecommonjs_exception_001.php on line 12