コード例 #1
0
ファイル: ExceptionHandler.php プロジェクト: qcind/Frame1.1
 /**
  * 显示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();
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
ファイル: LexException.php プロジェクト: mcuelenaere/plitz
 /**
  * @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;
 }
コード例 #6
0
ファイル: MathException.php プロジェクト: bradley-holt/zf2
 public function __construct($message, $op1 = null, $op2 = null, $result = null)
 {
     $this->op1 = $op1;
     $this->op2 = $op2;
     $this->result = $result;
     parent::__construct($message);
 }
コード例 #7
0
 /**
  * @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))));
 }
コード例 #8
0
 /**
  * {@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);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 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);
 }
コード例 #11
0
ファイル: SyntaxException.php プロジェクト: janeklb/moodle
 /**
  * @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);
     }
 }
コード例 #12
0
 /**
  * @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);
 }
コード例 #13
0
 /**
  * @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);
     }
 }
コード例 #15
0
 /**
  * @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);
 }
コード例 #16
0
 /**
  * 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);
 }
コード例 #17
0
ファイル: BadXMLException.class.php プロジェクト: extend/wee
 /**
 	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);
 }
コード例 #18
0
 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);
 }
コード例 #20
0
 public function __construct($msg, array $token)
 {
     $this->token = $token;
     parent::__construct($msg);
 }
コード例 #21
0
 public function __construct($urn)
 {
     parent::__construct(sprintf('Urn "%s" has not been defined in the AttributeDictionary', $urn));
 }
コード例 #22
0
 /**
  * @param EventInterface $event
  * @param int            $message
  */
 public function __construct(EventInterface $event, $message)
 {
     parent::__construct($message);
     $this->event = $event;
 }
コード例 #23
0
 /**
  * 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);
 }
コード例 #24
0
 /**
  * @param string $uniqueness
  */
 public function __construct($uniqueness)
 {
     parent::__construct(sprintf("The profile with uniqueness \"%s\" should exist but it was not found.", $uniqueness));
 }
コード例 #25
0
 public function __construct()
 {
     return parent::__construct('Invalid token for current workflow');
 }
コード例 #26
0
 public function __construct($key)
 {
     parent::__construct(sprintf('Mutability Violation: the key "%s" is set to read_only.', $key));
 }
コード例 #27
0
 public function __construct($value, $expectedType)
 {
     parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
 }
コード例 #28
0
 /**
  * @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);
 }
コード例 #29
0
 /**
  * @inheritdoc
  */
 public function __construct($message = self::DEFAULT_MESSAGE, $code = 500, \Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
コード例 #30
0
 /**
  * @param string $className
  */
 public function __construct($className)
 {
     parent::__construct(sprintf('DataSet service is missing in "%s"', $className));
 }