Skip to content
Browse files

Rely on exceptions

  • Loading branch information...
1 parent 84e55b9 commit a2f51c834f6ad45285d0cc110d4ab9ec923cff0f @CloCkWeRX CloCkWeRX committed
Showing with 2 additions and 112 deletions.
  1. +0 −78 RDF.php
  2. +2 −34 RDF/Exception.php
View
78 RDF.php
@@ -193,85 +193,7 @@ function factory($class, &$param)
}
// }}}
- // {{{ raiseError()
- /**
- * This method is used to communicate an error and invoke error
- * callbacks etc. Basically a wrapper for PEAR::raiseError
- * without the message string.
- *
- * @param mixed integer error code, or a PEAR error object (all
- * other parameters are ignored if this parameter is
- * an object
- *
- * @param int error mode, see PEAR_Error docs
- *
- * @param mixed If error mode is PEAR_ERROR_TRIGGER, this is the
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- *
- * @param string Extra debug information. Defaults to the last
- * query and native error code.
- *
- * @return object a PEAR error object
- *
- * @see PEAR_Error
- */
- function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
- {
- // The error is yet a MDB error object
- if (is_object($code)) {
- // because we the static PEAR::raiseError, our global
- // handler should be used if it is set
- if ($mode === null && !empty($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- }
- return PEAR::raiseError($code, null, $mode, $options, null, null, true);
- }
-
- return PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'RDF_Error', true);
- }
- /**
- * Return a textual error message for a RAP error code.
- *
- * @access public
- * @param int error code
- * @return string error message
- */
- function errorMessage($value)
- {
- // make the variable static so that it only has to do the defining on the first call
- static $errorMessages;
-
- // define the varies error messages
- if (!isset($errorMessages)) {
- $errorMessages = array(
- RDF_ERROR => 'Unknown error',
- RDF_ERROR_NOT_SUPPORTED => 'Feature not supported',
- RDF_ERROR_CONFIG_ERROR => 'Config file error',
- RDF_ERROR_MISSING_DEPS => 'Missing package depedencies',
- RDF_ERROR_UNEXPECTED => 'Unexpected',
- RDF_ERROR_MISMATCH => 'Mismatch',
- );
- }
-
- // If this is an error object, then grab the corresponding error code
- if (RDF::isError($value)) {
- $value = $value->getCode();
- }
-
- // return the textual error message corresponding to the code
- return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[RDF_ERROR];
- } // end func errorMessage
-
- function isError($value)
- {
- return is_a($value, 'RDF_Error');
- }
}
require_once 'RDF/Exception.php';
View
36 RDF/Exception.php
@@ -1,35 +1,3 @@
<?php
-/**
- * RDF_Error implements a class for reporting RDF error
- * messages.
- *
- * @package RDF
- * @category RDF
- * @author Stig Bakken <ssb@fast.no>
- */
-class RDF_Error extends PEAR_Error
-{
- // }}}
- // {{{ constructor
-
- /**
- * RDF_Error constructor.
- *
- * @param mixed $code RDF error code, or string with error message.
- * @param integer $mode what 'error mode' to operate in
- * @param integer $level what error level to use for
- * $mode & PEAR_ERROR_TRIGGER
- * @param smixed $debuginfo additional debug info, such as the last query
- */
- function RDF_Error($code = RDF_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('RDF Error: '.RDF::errorMessage($code), $code,
- $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("RDF Error: $code", RDF_ERROR, $mode, $level,
- $debuginfo);
- }
- }
-}
+class RDF_Exception extends Exception
+{}

0 comments on commit a2f51c8

Please sign in to comment.
Something went wrong with that request. Please try again.