This commit is contained in:
Jan Philipp Timme
2010-11-21 22:48:11 +00:00
parent 01018862f7
commit 952af43b97
23 changed files with 3314 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
<?php
class TestException extends Exception{
function __construct($message) {
$this->message = $message;
}
}
class TestFailException extends Exception {
function __construct($msg) {
$this->message = "Error: ".$msg;
}
}
class Service_ExceptionTest {
function __construct() {
}
public function TestTheFail() {
$this->failAtThis();
}
public function CatchAndThrow() {
try {
$this->failAtThis();
}
catch (Exception $e) {
throw new TestFailException("moep:D");
}
}
public function internalCatch() {
try {
$this->failAtThis();
}
catch (Exception $e) {
var_dump($e);
}
}
function failAtThis() {
throw new TestException("I had to do this. Please forgive me :/");
}
}
try {
$ExceptionTest = new Service_ExceptionTest;
$ExceptionTest->CatchAndThrow();
} catch (Exception $e){
var_dump($e);
}
?>