Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 7e996c7

Browse files
committed
Rename V8\Exceptions\GenericException to V8\Exceptions\Exception
1 parent 578955e commit 7e996c7

25 files changed

+49
-49
lines changed

src/php_v8_exceptions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static const zend_function_entry php_v8_value_exception_methods[] = {
215215
PHP_MINIT_FUNCTION(php_v8_exceptions) {
216216
zend_class_entry ce;
217217

218-
INIT_NS_CLASS_ENTRY(ce, "V8\\Exceptions", "GenericException", php_v8_exception_methods);
218+
INIT_NS_CLASS_ENTRY(ce, "V8\\Exceptions", "Exception", php_v8_exception_methods);
219219
php_v8_generic_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default());
220220

221221
INIT_NS_CLASS_ENTRY(ce, "V8\\Exceptions", "TryCatchException", php_v8_try_catch_exception_methods);

src/php_v8_script_origin.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ v8::ScriptOrigin *php_v8_create_script_origin_from_zval(zval *value, v8::Isolate
8383
v8::MaybeLocal<v8::String> local_resource_name = v8::String::NewFromUtf8(isolate, Z_STRVAL_P(resource_name_zv), v8::NewStringType::kNormal, (int)Z_STRLEN_P(resource_name_zv));
8484

8585
if (local_resource_name.IsEmpty()) {
86-
zend_throw_exception(php_v8_generic_exception_class_entry, "Invalid resource name", 0);
86+
PHP_V8_THROW_EXCEPTION("Invalid resource name");
8787
return nullptr;
8888
}
8989

@@ -113,7 +113,7 @@ v8::ScriptOrigin *php_v8_create_script_origin_from_zval(zval *value, v8::Isolate
113113
v8::MaybeLocal<v8::String> local_source_map_url = v8::String::NewFromUtf8(isolate, Z_STRVAL_P(source_map_url_zv), v8::NewStringType::kNormal, (int)Z_STRLEN_P(source_map_url_zv));
114114

115115
if (local_source_map_url.IsEmpty()) {
116-
zend_throw_exception(php_v8_generic_exception_class_entry, "Invalid source map url", 0);
116+
PHP_V8_THROW_EXCEPTION("Invalid source map url");
117117
return nullptr;
118118
}
119119

src/php_v8_stack_trace.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ static PHP_METHOD(V8StackTrace, GetFrame)
9999
frames = zend_read_property(this_ce, getThis(), ZEND_STRL("frames"), 0, &rv);
100100

101101
if (index < 0) {
102-
zend_throw_exception(php_v8_generic_exception_class_entry, "Fame index is out of range", 0);
102+
PHP_V8_THROW_EXCEPTION("Fame index is out of range");
103103
return;
104104
}
105105

106106
frame = zend_hash_index_find(Z_ARRVAL_P(frames), static_cast<zend_ulong>(index));
107107

108108
if (frame == NULL) {
109-
zend_throw_exception(php_v8_generic_exception_class_entry, "Fame index is out of range", 0);
109+
PHP_V8_THROW_EXCEPTION("Fame index is out of range");
110110
return;
111111
}
112112

src/php_v8_startup_data.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static PHP_METHOD(V8StartupData, __construct) {
6868
}
6969

7070
if (ZSTR_LEN(blob) > INT_MAX) {
71-
zend_throw_exception(php_v8_generic_exception_class_entry, "Failed to create startup blob due to blob size integer overflow", 0);
71+
PHP_V8_THROW_EXCEPTION("Failed to create startup blob due to blob size integer overflow");
7272
return;
7373
}
7474

stubs/src/Exceptions/GenericException.php renamed to stubs/src/Exceptions/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
namespace V8\Exceptions;
1717

1818

19-
class GenericException extends \Exception
19+
class Exception extends \Exception
2020
{
2121
}

stubs/src/Exceptions/TryCatchException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use V8\Isolate;
2121
use V8\TryCatch;
2222

23-
class TryCatchException extends GenericException
23+
class TryCatchException extends Exception
2424
{
2525
/**
2626
* @var Isolate

stubs/src/Exceptions/ValueException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
namespace V8\Exceptions;
1616

1717

18-
class ValueException extends GenericException
18+
class ValueException extends Exception
1919
{
2020
}

stubs/src/StackTrace.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace V8;
1717

1818

19-
use V8\Exceptions\GenericException;
19+
use V8\Exceptions\Exception;
2020
use V8\StackTrace\StackTraceOptions;
2121

2222

@@ -67,12 +67,12 @@ public function GetFrames() : array
6767
*
6868
* @return StackFrame
6969
*
70-
* @throws GenericException When index is out of range
70+
* @throws Exception When index is out of range
7171
*/
7272
public function GetFrame(int $index) : StackFrame
7373
{
7474
if ($index < 0 || !isset($this->frames[$index])) {
75-
throw new GenericException('Frame index is out of range');
75+
throw new Exception('Frame index is out of range');
7676
}
7777

7878
return $this->frames[$index];

tests/003-V8ObjectTemplate_recursive_chain.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ V8\ObjectTemplate - recursive 2
55
--FILE--
66
<?php
77

8-
use V8\Exceptions\GenericException;
8+
use V8\Exceptions\Exception;
99

1010
/** @var \Phpv8Testsuite $helper */
1111
$helper = require '.testsuite.php';
@@ -26,7 +26,7 @@ $template2->Set(new \V8\StringValue($isolate, 'that3'), $template3);
2626

2727
try {
2828
$template3->Set(new \V8\StringValue($isolate, 'that1'), $template2);
29-
} catch (GenericException $e) {
29+
} catch (Exception $e) {
3030
$helper->exception_export($e);
3131
}
3232

@@ -36,4 +36,4 @@ $context->GlobalObject()->Set($context, new \V8\StringValue($isolate, 'test'), $
3636

3737
?>
3838
--EXPECT--
39-
V8\Exceptions\GenericException: Can't set: recursion detected
39+
V8\Exceptions\Exception: Can't set: recursion detected

tests/003-V8ObjectTemplate_recursive_global.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ V8\ObjectTemplate
55
--FILE--
66
<?php
77

8-
use V8\Exceptions\GenericException;
8+
use V8\Exceptions\Exception;
99

1010
/** @var \Phpv8Testsuite $helper */
1111
$helper = require '.testsuite.php';
@@ -21,7 +21,7 @@ $template = new \V8\ObjectTemplate($isolate);
2121

2222
try {
2323
$template->Set(new \V8\StringValue($isolate, 'self'), $template);
24-
} catch (GenericException $e) {
24+
} catch (Exception $e) {
2525
$helper->exception_export($e);
2626
}
2727

@@ -30,4 +30,4 @@ $context = new \V8\Context($isolate, $template);
3030

3131
?>
3232
--EXPECT--
33-
V8\Exceptions\GenericException: Can't set: recursion detected
33+
V8\Exceptions\Exception: Can't set: recursion detected

0 commit comments

Comments
 (0)