Skip to content

Instantly share code, notes, and snippets.

@jimrubenstein
Created May 1, 2012 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimrubenstein/2570424 to your computer and use it in GitHub Desktop.
Save jimrubenstein/2570424 to your computer and use it in GitHub Desktop.
<?
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