Created
May 1, 2012 18:49
-
-
Save jimrubenstein/2570424 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class MyException extends Exception | |
{ | |
public function getType() { return 'NotException'; } | |
} | |
function doTest() | |
{ | |
$e = new MyException('stupid php', 1); | |
throw $e; | |
} | |
try | |
{ | |
doTest(); | |
echo "no exception.\ndone\n"; | |
} | |
catch (Exception $e) | |
{ | |
echo "exception is 'Exception'\n"; | |
} | |
catch (MyException $e) | |
{ | |
echo "exception is 'MyException'\n"; | |
} | |
catch (NotException $e) | |
{ | |
echo "exception is 'NotException'\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment