function dispatch() { require_once KT_LIB_DIR . '/validation/customerror.php'; $bCustomCheck = KTCustomErrorCheck::customErrorInit($this->oError); if ($bCustomCheck) { exit(0); } //if either customer error messages is off or the custom error page doesn't exist the function will run //the default error handling here $oRegistry =& KTErrorViewerRegistry::getSingleton(); $oViewer =& $oRegistry->getViewer($this->oError); $this->oPage->setTitle($oViewer->view()); $this->oPage->hideSection(); $this->handleOutput($oViewer->page()); }
function handleError($aOptions = null) { $aOptions = (array) $aOptions; $aRedirectTo = KTUtil::arrayGet($aOptions, 'redirect_to'); $oException = KTUtil::arrayGet($aOptions, 'exception'); $sMessage = KTUtil::arrayGet($aOptions, 'message'); $sDefaultMessage = KTUtil::arrayGet($aOptions, 'defaultmessage'); if (empty($sMessage)) { if ($oException) { $oEVRegistry = KTErrorViewerRegistry::getSingleton(); $oViewer = $oEVRegistry->getViewer($oException); $sMessage = $oViewer->view(); } elseif ($sDefaultMessage) { $sMessage = $sDefaultMessage; } else { $sMessage = _kt("An error occurred, and no error message was given"); } } else { if ($oException) { $sMessage .= ': ' . $oException->getMessage(); } } if ($aRedirectTo) { $aRedirectParams = KTUtil::arrayGet($aRedirectTo, 1); $aRealRedirectTo = array($aRedirectTo[0], $sMessage, $aRedirectParams); $aRealRedirectTo[] = $oException; call_user_func_array(array($this->oDispatcher, 'errorRedirectTo'), $aRealRedirectTo); } $this->oDispatcher->errorPage($sMessage, $oException); }
return new KTStringErrorViewer($oError->getMessage()); } // PEAR_Error should have caught things above, but just in case, // check if getMessage is there, and use that: if (method_exists($oError, 'getMessage')) { return new KTStringErrorViewer($oError->getMessage()); } // Check if we are a string if (is_string($oError)) { return new KTStringErrorViewer($oError); } // Give up. return new KTStringErrorViewer(_kt("Unknown error")); } } $oEVRegistry =& KTErrorViewerRegistry::getSingleton(); class KTErrorViewer { function KTErrorViewer($oError) { $this->oError = $oError; } function view() { return $this->oError->getMessage(); } function viewFull() { return $this->oError->toString(); } function page()