_fm =& $fm; parent::PEAR_Error($message, $code); // Log the error. $fm->log($this->getMessage(), FILEMAKER_LOG_ERR); } /** * Overloads getMessage() to return an equivalent FileMaker Web Publishing * Engine error if no message is explicitly set and this object has an * error code. * * @return string Error message. */ function getMessage() { if ($this->message === null && $this->getCode() !== null) { return $this->getErrorString(); } return parent::getMessage(); } /** * Returns the string representation of $this->code in the language * currently set for PHP error messages in FileMaker Server Admin * Console. * * You should call getMessage() in most cases, if you are not sure whether * the error is a FileMaker Web Publishing Engine error with an error code. * * @return string Error description. */ function getErrorString() { // Default to English. $lang = basename($this->_fm->getProperty('locale')); if (!$lang) { $lang = 'en'; } static $strings = array(); if (empty($strings[$lang])) { if (!@include_once dirname(__FILE__) . '/Error/' . $lang . '.php') { include_once dirname(__FILE__) . '/Error/en.php'; } $strings[$lang] = $__FM_ERRORS; } if (isset($strings[$lang][$this->getCode()])) { return $strings[$lang][$this->getCode()]; } return $strings[$lang][-1]; } /** * Indicates whether the error is a detailed pre-validation error * or a FileMaker Web Publishing Engine error. * * @return boolean FALSE, to indicate that this is an error from the * Web Publishing Engine. */ function isValidationError() { return false; } }