fetus Diary
2007/09/21(金) - re-throw
<?php
class TestException extends Exception {
}
try {
try {
throw new TestException('hoge');
} catch(Exception $e) {
printf("catch exception '%s' at %s line %d, msg: %s\n",
get_class($e),
basename(__FILE__), __LINE__,
$e->getMessage());
throw $e;
}
} catch(Exception $e) {
printf("catch exception '%s' at %s line %d, msg: %s\n",
get_class($e),
basename(__FILE__), __LINE__,
$e->getMessage());
}
?>
[******@kobora ~]$ php hoge.php
catch exception 'TestException' at hoge.php line 11, msg: hoge
catch exception 'TestException' at hoge.php line 18, msg: hoge
PHP のマニュアルで特に言及が無い点を見ると、これで正解? C++ みたいに特殊構文は無し、かな?
- 07/09/21 12:29
コメント
コメントはありません。