<?php /******************************************************************* * ExceptionsTest.php * Copyright (C) 2006 Midnight Coders, LLC * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * The software is licensed under the GNU General Public License (GPL) * For details, see http://www.gnu.org/licenses/gpl.txt. ********************************************************************/ // This simple class demonstrates how application exceptions // get propagates to the client. The client application // invokes various methods available in the class. The method // cause an exception to happen. In all cases exceptions delivered // to the calling program as faults. require_once("MyException.php"); class ExceptionsTest { public function divByZero() { throw new Exception("Divide by zero exception"); } public function NPE() { throw new Exception("Null pointer exception"); } public function throwException() { throw new MyException( "this is a custom application exception" ); } } ?>