at 2005-01-25
in Announcements, Homepage
by friebe
(0 comments)
A new core function raise() was added. This function is an equivalent to throw(), except that it does not take an object as sole argument, but rather a fully qualified class name and a message - raise() will then load the class using XPClass::forName() and the default classloader.
This implements RFC #0014 - see also entry #32
Example:
require('lang.base.php');
try(); { raise('io.IOException', 'Cannot read file'); } if (catch('IOException', $e)) { $e->printStackTrace(); } This will print out the following:Exception io.IOException (Cannot read file) at io.IOException::__construct((0x10)'Cannot read file') [line 87 of StackTraceElement.class.php] at <main>::eval() [line 114 of XPClass.class.php] at lang.XPClass::newinstance((0x10)'Cannot read file') [line 228 of lang.base.php] at <main>::raise((0xe)'io.IOException', (0x10)'Cannot read file') [line 5 of test.php]
|
Subscribe
You can subscribe to the XP framework's news by using RSS syndication.
CategoriesNews General PHP5 Announcements RFCs Further reading Examples Editorial EASC Experiments Unittests Databases 5.8-SERIES Unicode Language 5.9-SERIES
RelatedFind related articles by a search for «New».
|