note 91604 added to exception.getprevious

From: Date: Fri, 19 Jun 2009 01:30:59 +0000
Subject: note 91604 added to exception.getprevious
Groups: php.notes 
Request: Send a blank email to php-notes+get-157110@lists.php.net to get a copy of this message
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? ---- Server IP: 64.71.164.2 Probable Submitter: 24.218.30.83 ---- Manual Page -- http://www.php.net/manual/en/exception.getprevious.php Edit -- https://master.php.net/note/edit/91604 Del: integrated -- https://master.php.net/note/delete/91604/integrated Del: useless -- https://master.php.net/note/delete/91604/useless Del: bad code -- https://master.php.net/note/delete/91604/bad+code Del: spam -- https://master.php.net/note/delete/91604/spam Del: non-english -- https://master.php.net/note/delete/91604/non-english Del: in docs -- https://master.php.net/note/delete/91604/in+docs Del: other reasons-- https://master.php.net/note/delete/91604 Reject -- https://master.php.net/note/reject/91604 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157110) next »