Skip to content

Instantly share code, notes, and snippets.

@MarioBlazek
Created April 29, 2019 10:21
Show Gist options
  • Save MarioBlazek/88bf1b2b0fd005c9f42a72f396552ae7 to your computer and use it in GitHub Desktop.
Save MarioBlazek/88bf1b2b0fd005c9f42a72f396552ae7 to your computer and use it in GitHub Desktop.
<?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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment