Created
July 15, 2015 20:09
-
-
Save jazzdan/1672598faa14b7c7c2a8 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
<?hh | |
interface ExceptionWithCode { | |
public function getCode(); | |
} | |
class Checkout_Exception extends Exception implements ExceptionWithCode { | |
protected $data = []; | |
public function __construct($msg = "", $code = 0, $data = []) { | |
$this->data = $data; | |
parent::__construct($msg, $code); | |
} | |
} | |
class Foo { | |
public function herp() { | |
try { | |
$x = 1 + 1; | |
} catch (ExceptionWithCode $e) { | |
throw new Checkout_Exception('hello', 42); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: