/** * 显示exception错误信息 * @param LogicException $e */ function handler($e) { if ($e->getCode() == 404 && !DEBUG) { header("HTTP/1.0 404 Not Found"); exit; } // 正式情况下 $this->out['_msg'] = $e->getMessage(); $this->out['_code'] = $e->getCode(); // 只有LogicException才需要显示详细,记录日志 if ($e instanceof LogicException) { // DEBUG时显示调试详细信息 if (DEBUG) { $this->out['_exception_detail']['trace'] = $this->getTraceDesc($e->getTrace()); $this->out['_exception_detail']['file'] = $e->getFile(); $this->out['_exception_detail']['line'] = $e->getLine(); } else { $this->out['_msg'] = '系统错误'; } } if (!$this->tpl) { $this->tpl = PATH_APP . '/template/msg.tpl'; } $this->display(); }
/** * Constructor * * @param string $errorCode status error code. * @param string $error string value of the error code. * @param string $reason detailed message for the error. * * @return WindowsAzure\Common\ServiceException */ public function __construct($errorCode, $error = null, $reason = null) { parent::__construct(sprintf(Resources::AZURE_ERROR_MSG, $errorCode, $error, $reason)); $this->code = $errorCode; $this->_error = $error; $this->_reason = $reason; }
public function __construct($message = '', $code = 0, \Exception $previous = null) { if (__CLASS__ === get_class($this)) { trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\\Component\\Form\\Exception\\AlreadySubmittedException class instead.', E_USER_DEPRECATED); } parent::__construct($message, $code, $previous); }
/** * @param string $name * @param \Gnugat\Redaktilo\Command\Command[] $commands */ public function __construct($name, array $commands) { $this->name = $name; $this->commands = $commands; $message = sprintf('The command "%s" was not found in CommandInvoker', $name); parent::__construct($message); }
/** * @param string $message * @param string $templateName * @param int $line * @param int $column */ public function __construct($message, $templateName, $line, $column) { parent::__construct($message); $this->templateName = $templateName; $this->templateLine = $line; $this->templateColumn = $column; }
public function __construct($message, $op1 = null, $op2 = null, $result = null) { $this->op1 = $op1; $this->op2 = $op2; $this->result = $result; parent::__construct($message); }
/** * @param string $message The failure reason * @param array $failedActions The list of failed action * @param callable $actionArgsToString The callback function to be used to convert an action arguments to a string * function ($action) returns string */ public function __construct($message, array $failedActions, $actionArgsToString = null) { $this->failedActions = $failedActions; parent::__construct(sprintf('%s Actions: %s.', $message, implode(', ', array_map(function (array $action) use($actionArgsToString) { $args = is_callable($actionArgsToString) ? call_user_func($actionArgsToString, $action) : null; return $args !== null && empty($args) || $args === null && empty($action['args']) ? sprintf('%s()', $action['name']) : sprintf('%s(%s)', $action['name'], is_string($args) ? $args : $action['args'][0]); }, $failedActions)))); }
/** * {@inheritDoc} */ public function __construct($message = "", $translation = null, $params = [], $code = 0, \Exception $previous = null) { if (null !== $translation) { $this->setTranslation($translation); } $this->setParams($params); parent::__construct($message, $code, $previous); }
public function __construct($message = null, $code = 0, \Exception $previous = null, $httpStatus = 500, $details = null) { $this->_httpStatus = $httpStatus; if ($details !== null) { $this->_details = $details; } parent::__construct($message, $code, $previous); }
public function __construct($bundle, $usage, $template, array $enabled, $code = 0, \Exception $previous = null) { $message = sprintf('You must add %s to the assetic.bundle config to use %s in %s.', $bundle, $usage, $template); if ($enabled) { $message .= sprintf(' (currently enabled: %s)', implode(', ', $enabled)); } parent::__construct($message, $code, $previous); }
/** * @param string $msg * @param array $token * @param Exception $previous */ public function __construct($msg, array $token, Exception $previous = null) { $this->token = $token; if (version_compare(PHP_VERSION, '5.3.0', '>=')) { parent::__construct($msg, 0, $previous); } else { parent::__construct($msg); } }
/** * @param string $from * @param int $to * @param string $message * @param int $code * @param Exception|null $previous */ public function __construct($from, $to, $message = '', $code = 0, Exception $previous = null) { $this->from = $from; $this->to = $to; if (empty($message)) { $message = sprintf('Invalid type cast: %s to %s.', $this->from, $this->to); } parent::__construct($message, $code, $previous); }
/** * @param Mixin $mixin * @param Schema[] $schemas */ public function __construct(Mixin $mixin, array $schemas) { $this->mixin = $mixin; $this->schemas = $schemas; $ids = array_map(function (Schema $schema) { return $schema->getId()->toString() . ' => ' . $schema->getClassName(); }, $schemas); parent::__construct(sprintf('MessageResolver returned multiple messages using [%s] when one was expected. ' . 'Messages found:' . PHP_EOL . '%s', $mixin->getId()->getCurieMajor(), implode(PHP_EOL, $ids))); }
public function __construct($type, $code = 0, Exception $previous = null) { $this->type = $type; $err = "No Permission:{$type}"; if ($previous instanceof Exception) { parent::__construct($err, $code, $previous); } else { parent::__construct($err, $code); } }
/** * @param mixed $pattern * @param array $searchStrategies */ public function __construct($pattern, array $searchStrategies) { $this->pattern = $pattern; $this->searchStrategies = $searchStrategies; $patternMessage = 'given pattern'; if (is_string($pattern) || is_int($pattern)) { $patternMessage .= ' "' . strval($pattern) . '"'; } $message = sprintf('The %s isn\'t supported by the Search Strategies registered in SearchEngine', $patternMessage); parent::__construct($message); }
/** * Instantiates a new InvalidPropertyNameException. * @param array $errorDetails the details of the error */ public function __construct($errorDetails) { $errorMessage = ""; foreach ($errorDetails as $key => $value) { if (strlen($errorMessage) < 1) { $errorMessage .= PHP_EOL; } $errorMessage .= $key . " field invalid. " . $value; } parent::__construct($errorMessage); }
/** Initialize a new BadXMLException instance. @param $sMessage The message of the exception. @param $oError The libxml error associated to the exception. */ public function __construct($sMessage, LibXmlError $oError = null) { $iCode = 0; if ($oError) { $sMessage .= "\n"; $sMessage .= sprintf(_WT('libxml returned the following error (line %d, column %d):'), $oError->line, $oError->column); $sMessage .= "\n" . $oError->message; $iCode = $oError->code; } parent::__construct($sMessage, $iCode); }
public function __construct($message, array $tried, $code = 404, \Exception $exception = null) { $this->tried = $tried; if ($tried) { $tried = implode("\n", array_map(function ($v) { return "- {$v}"; }, $tried)); $message .= " The following files were tried:\n\n" . $tried; } else { $message .= " Also, no possible files were specified."; } parent::__construct($message, $code, $exception); }
/** * @param Route $route the route we're tried to add * @param int $name the name given to the route we tried to add * @param Route $routeWithSameName the existing route with the same name */ public function __construct(Route $route, $name, Route $routeWithSameName) { // host to string if (!($host = $route->getHost())) { $host = 'any'; } if (!($hostRouteWithSameName = $routeWithSameName->getHost())) { $hostRouteWithSameName = 'any'; } // methods to string if ($methods = $route->getMethods()) { $methods = implode($methods, ', '); } else { $methods = 'any'; } if ($methodsRouteWithSameName = $routeWithSameName->getMethods()) { $methodsRouteWithSameName = implode($methodsRouteWithSameName, ', '); } else { $methodsRouteWithSameName = 'any'; } $message = sprintf("Cannot add the route [path: %s, host: %s, methods: %s] with the name '%s'\n as it is already used by the route [path: %s, host: %s, methods: %s].", $route->getPath(), $host, $methods, $name, $routeWithSameName->getPath(), $hostRouteWithSameName, $methodsRouteWithSameName); parent::__construct($message); }
public function __construct($msg, array $token) { $this->token = $token; parent::__construct($msg); }
public function __construct($urn) { parent::__construct(sprintf('Urn "%s" has not been defined in the AttributeDictionary', $urn)); }
/** * @param EventInterface $event * @param int $message */ public function __construct(EventInterface $event, $message) { parent::__construct($message); $this->event = $event; }
/** * Initializes the {@link $scope_name} and {@link $model} properties. * * @param string $scope_name Name of the scope. * @param Model $model Model on which the scope was invoked. * @param int $code Default to 404. * @param \Exception $previous Previous exception. */ public function __construct($scope_name, Model $model, $code = 500, \Exception $previous = null) { $this->scope_name = $scope_name; $this->model = $model; parent::__construct($this->format_message($scope_name, $model), $code, $previous); }
/** * @param string $uniqueness */ public function __construct($uniqueness) { parent::__construct(sprintf("The profile with uniqueness \"%s\" should exist but it was not found.", $uniqueness)); }
public function __construct() { return parent::__construct('Invalid token for current workflow'); }
public function __construct($key) { parent::__construct(sprintf('Mutability Violation: the key "%s" is set to read_only.', $key)); }
public function __construct($value, $expectedType) { parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); }
/** * @param string $mode * @param string $msg * @param PHPUnit_Extensions_Database_UI_IModeFactory $modeFactory */ public function __construct($mode, $msg, PHPUnit_Extensions_Database_UI_IModeFactory $modeFactory) { $this->mode = $mode; $this->modeFactory = $modeFactory; parent::__construct($msg); }
/** * @inheritdoc */ public function __construct($message = self::DEFAULT_MESSAGE, $code = 500, \Exception $previous = null) { parent::__construct($message, $code, $previous); }
/** * @param string $className */ public function __construct($className) { parent::__construct(sprintf('DataSet service is missing in "%s"', $className)); }