Created
April 29, 2019 10:33
-
-
Save MarioBlazek/03ae3564bacf22ba53c094a30d4aaf54 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
class MyCustomException extends Exception { } | |
function throwMyCustomException() { | |
throw new MyCustomException('There is something wrong.'); | |
} | |
try { | |
throwMyCustomException(); | |
} catch (MyCustomException $e) { | |
echo "Your custom exception caught "; | |
echo $e->getMessage(); | |
} catch (Exception $e) { | |
echo "PHP base exception caught"; | |
} finally { | |
echo "I'm always here"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment