note 91604 rejected from exception.getprevious by danbrown

From: Date: Fri, 19 Jun 2009 01:34:20 +0000
Subject: note 91604 rejected from exception.getprevious by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157111@lists.php.net to get a copy of this message
Note Submitter: vividexstance at hotmail dot com dot com ---- This is the script I am running: <html> <head> <title>Exception::getPrevious()</title> </head> <body> <pre> <?php class MyCustomException extends Exception {} function doStuff() { try { throw new InvalidArgumentException("You are doing it wrong!", 112); } catch(Exception $e) { throw new MyCustomException("Something happend", 911, $e); } } try { doStuff(); } catch(Exception $e) { do { printf("%s:%d %s (%d) [%s]\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e)); } while($e = $e->getPrevious()); } ?> </pre> <hr /><a href="/php/predefineException/index.php">Go Back</a> </body> </html> When I view it in Firefox, it display this error message: "Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in C:\wamp\www\php\predefinedExceptions\getPrevious.php on line 14" I copied and pasted the php, I added the html stuff. Why is there a Fatal error?

« previous php.notes (#157111) next »