diff options
author | Sterling Hughes <sterling@php.net> | 2000-07-21 06:47:18 +0000 |
---|---|---|
committer | Sterling Hughes <sterling@php.net> | 2000-07-21 06:47:18 +0000 |
commit | 4773b98ac634ca280b64b56f43fedd44e47f3b90 (patch) | |
tree | 756f3b0d5975a4c39358d4f8ddd7aeb5ef5bb737 | |
parent | f869e47eaef3fa251a10e5b7857c0d2e5124dc34 (diff) | |
download | php-git-4773b98ac634ca280b64b56f43fedd44e47f3b90.tar.gz |
Add PEAR_ERROR class for returning exception objects.
# This is the basic idea that Ulf proposed, its obviously
# going to be subject to modifications.
-rw-r--r-- | pear/Makefile.in | 3 | ||||
-rw-r--r-- | pear/PEAR_ERROR.php | 62 |
2 files changed, 64 insertions, 1 deletions
diff --git a/pear/Makefile.in b/pear/Makefile.in index 92818c0d78..e427a020cb 100644 --- a/pear/Makefile.in +++ b/pear/Makefile.in @@ -18,7 +18,8 @@ PEAR_FILES = \ DB/pgsql.php \ DB/storage.php \ HTTP.php \ - File/Find.php + File/Find.php \ + PEAR_ERROR.php install-data-local: @if $(mkinstalldirs) $(peardir); then \ diff --git a/pear/PEAR_ERROR.php b/pear/PEAR_ERROR.php new file mode 100644 index 0000000000..1c45bd23a0 --- /dev/null +++ b/pear/PEAR_ERROR.php @@ -0,0 +1,62 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP version 4.0 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_0.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Sterling Hughes <sterling@php.net> | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +// Commonly needed functions searching directory trees +// + +// +// This class is based on ideas from Ulf Wendel +// + +class PEAR_ERROR +{ + var $CLASSNAME = ''; + var $ERROR_MESSAGE_PREFIX = ''; + var $ERROR_PREPEND = ''; + var $ERROR_APPEND = ''; + + var $DIE_ON_ERROR = ''; + var $AUTO_PRINT_ERROR = ''; + + var $LEVEL = 0; + var $TRIGGER_ERROR = false; + + var $message = ''; + var $file = ''; + var $line = 0; + + function PEAR_ERROR ($message, $file = __FILE__, $line = __LINE__) + { + $this->message = $message; + $this->file = $file; + $this->line = $line; + } + + function getMessage () + { + return ($this->ERROR_PREPEND . $this->ERROR_MESSAGE_PREFIX . + $this->message . $this->ERROR_APPEND); + } + + function getType () + { + return ($this->CLASSNAME); + } +}
\ No newline at end of file |