コード例 #1
0
ファイル: JsonFormatterTest.php プロジェクト: naldz/cyberden
 public function testDefFormatWithPreviousException()
 {
     $formatter = new JsonFormatter();
     $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
     $formattedPrevException = $this->formatException($exception->getPrevious());
     $formattedException = $this->formatException($exception, $formattedPrevException);
     $message = $this->formatRecordWithExceptionInContext($formatter, $exception);
     $this->assertContextContainsFormattedException($formattedException, $message);
 }
コード例 #2
0
ファイル: JsonFormatterTest.php プロジェクト: jorjoh/Varden
 public function testDefFormatWithPreviousException()
 {
     $formatter = new JsonFormatter();
     $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
     $message = $formatter->format(array('level_name' => 'CRITICAL', 'channel' => 'core', 'context' => array('exception' => $exception), 'datetime' => new \DateTime(), 'extra' => array(), 'message' => 'foobar'));
     if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
         $pathPrevious = substr(json_encode($exception->getPrevious()->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
         $pathException = substr(json_encode($exception->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
     } else {
         $pathPrevious = substr(json_encode($exception->getPrevious()->getFile()), 1, -1);
         $pathException = substr(json_encode($exception->getFile()), 1, -1);
     }
     $this->assertEquals('{"level_name":"CRITICAL","channel":"core","context":{"exception":{"class":"RuntimeException","message":"' . $exception->getMessage() . '","code":' . $exception->getCode() . ',"file":"' . $pathException . ':' . $exception->getLine() . '","previous":{"class":"LogicException","message":"' . $exception->getPrevious()->getMessage() . '","code":' . $exception->getPrevious()->getCode() . ',"file":"' . $pathPrevious . ':' . $exception->getPrevious()->getLine() . '"}}},"datetime":' . json_encode(new \DateTime()) . ',"extra":[],"message":"foobar"}' . "\n", $message);
 }
コード例 #3
0
 public function __construct($invalidHelper, array $supportedHelpers, \Exception $previous = null)
 {
     $message = sprintf('Unsupported helper "%s". It must be one of %s.', $invalidHelper, implode(', ', $supportedHelpers));
     parent::__construct($message, 0, $previous);
     $this->invalidHelper = $invalidHelper;
     $this->supportedHelpers = $supportedHelpers;
 }
コード例 #4
0
 /**
  * Public constructor.
  */
 public function __construct()
 {
     $message = 'You must authenticate to access this resource.';
     $code = 401;
     $this->statusCode = $code;
     parent::__construct($message, $code);
 }
コード例 #5
0
 public function __construct($method, array $allowedMethods, \Exception $previous = null)
 {
     $message = sprintf('Method "%s" is not allowed and must be one of "%s".', $method, implode(', ', $allowedMethods));
     parent::__construct($message, 0, $previous);
     $this->method = $method;
     $this->allowedMethods = $allowedMethods;
 }
コード例 #6
0
ファイル: PossiblySuhosin.php プロジェクト: Joal01/fof
 public function __construct($message = "", $code = 403, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('LIB_FOF_VIEW_POSSIBLYSUHOSIN');
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #7
0
 /**
  *
  * @param string $message
  * @param integer $statusCode
  * @param \Exception $previous
  * @param array $errors
  * @param array $headers
  */
 public function __construct($message, $statusCode = 0, \Exception $previous = null, array $errors = [], array $headers = [])
 {
     $this->statusCode = $statusCode;
     $this->headers = $headers;
     $this->errors = $errors;
     parent::__construct($message, $statusCode, $previous);
 }
コード例 #8
0
ファイル: XmlParseException.php プロジェクト: disider/Propel2
 /**
  * Create an exception based on LibXMLError objects
  *
  * @param array $errors Array of LibXMLError objects
  * @see http://www.php.net/manual/en/class.libxmlerror.php
  */
 public function __construct(array $errors)
 {
     $numErrors = count($errors);
     if (1 == $numErrors) {
         $message = "An error occurred ";
     } elseif ($numErrors > 1) {
         $message = "Some errors occurred ";
     }
     $message .= "while parsing XML configuration file:\n";
     foreach ($errors as $error) {
         $message .= " - ";
         switch ($error->level) {
             case LIBXML_ERR_WARNING:
                 $message .= "Warning {$error->code}: ";
                 break;
             case LIBXML_ERR_ERROR:
                 $message .= "Error {$error->code}: ";
                 break;
             case LIBXML_ERR_FATAL:
                 $message .= "Fatal Error {$error->code}: ";
                 break;
         }
         $message .= $error->message;
     }
     parent::__construct($message);
 }
コード例 #9
0
 public function WrongTypeException($msg = null)
 {
     if (is_null($msg)) {
         $msg = "Tipo inválido";
     }
     parent::__construct($msg);
 }
コード例 #10
0
 /**
  * Creates an instance.
  *
  * @param string     $optionKey
  * @param int        $target
  * @param \Exception $previous
  */
 public function __construct($optionKey, $target, \Exception $previous = null)
 {
     $this->optionKey = $optionKey;
     $this->target = $target;
     $message = sprintf('Missing value for option "%s" in "%s"', $optionKey, $this->getTargetFQCN());
     parent::__construct($message, 0, $previous);
 }
 /**
  * @param string $message
  * @param string $actorId
  * @param \DateTimeInterface $sinceDate
  * @param \DateTimeInterface $actualDate
  */
 public function __construct($message, $actorId, \DateTimeInterface $sinceDate, \DateTimeInterface $actualDate)
 {
     parent::__construct($message);
     $this->actorId = $actorId;
     $this->sinceDate = $sinceDate;
     $this->actualDate = $actualDate;
 }
コード例 #12
0
ファイル: ServiceException.php プロジェクト: a07061625/upload
 public function __construct($errorCode, $message, $requestId, $hostId)
 {
     parent::__construct($message);
     $this->requestId = $requestId;
     $this->hostId = $hostId;
     $this->errorCode = $errorCode;
 }
コード例 #13
0
ファイル: RowCountException.php プロジェクト: ddrozdik/dmaps
 public function __construct($message = NULL, $code = 0, \Exception $previous = NULL)
 {
     if (!isset($message)) {
         $message = "rowCount() is supported for DELETE, INSERT, or UPDATE statements performed with structured query builders only, since they would not be portable across database engines otherwise. If the query builders are not sufficient, set the 'return' option to Database::RETURN_AFFECTED to get the number of affected rows.";
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #14
0
 public function App42Exception3($detailMessage, $httpErrorCode, $appErrorCode)
 {
     $this->detailMessage = $detailMessage;
     $this->httpErrorCode = $httpErrorCode;
     $this->appErrorCode = $appErrorCode;
     return parent::__construct($detailMessage, $httpErrorCode);
 }
コード例 #15
0
 public function __construct($name, $value = null, $message = null, $code = 0, \Exception $prevException = null)
 {
     $this->argumentName = $name;
     $this->argumentValue = $value;
     $message = $message ?: sprintf('The argument for "%s" is invalid.', $name);
     parent::__construct($message, $code, $prevException);
 }
コード例 #16
0
 public function WrongTypeException($msg = null)
 {
     if ($msg == null) {
         $msg = "Esta planilha contem um formato inválido de acordo com os padrões definidos.";
     }
     parent::__construct($msg);
 }
 /**
  * @param AggregateRootIdentifier $identifier
  * @param int                     $expectedVersion
  * @param int                     $actualVersion
  */
 public function __construct(AggregateRootIdentifier $identifier, $expectedVersion, $actualVersion)
 {
     $this->identifier = $identifier;
     $this->expectedVersion = (int) $expectedVersion;
     $this->actualVersion = (int) $actualVersion;
     parent::__construct(sprintf('Got an unexpected version [%d] instead of [%d] for aggregate [%s].', $this->actualVersion, $this->expectedVersion, $identifier->toString()));
 }
コード例 #18
0
 public function __construct($message = null, $code = null, \Exception $previous = null)
 {
     if (is_null($message)) {
         $message = 'The model for Dobee is invalid!';
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #19
0
ファイル: RenderException.php プロジェクト: spress/spress
 /**
  * Constructor.
  *
  * @param string    $message  The exception message
  * @param string    $id       The identifier of the content where the exception was created
  * @param Exception $previous The previous exception
  */
 public function __construct($message, $id = null, \Exception $previous = null)
 {
     $this->rawMessage = $message;
     $this->id = $id;
     $this->updateRepr();
     parent::__construct($this->message, 0, $previous);
 }
コード例 #20
0
ファイル: ResourceException.php プロジェクト: margery/thelia
 public function __construct($message, $code = null, $previous = null)
 {
     if ($code === null) {
         $code = self::UNKNOWN_EXCEPTION;
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #21
0
ファイル: Exception.php プロジェクト: shabbyrobe/tempe
 function __construct($message = '', $line = null, $code = null, \Exception $previous = null)
 {
     if ($line) {
         $message .= " at line {$line}";
     }
     parent::__construct(trim($message), $code, $previous);
 }
コード例 #22
0
ファイル: LockedRecord.php プロジェクト: akeeba/fof
 public function __construct($message = "", $code = 403, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('LIB_FOF_CONTROLLER_ERR_LOCKED');
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #23
0
ファイル: OAuthException.php プロジェクト: KinaMarie/connect
 /**
  * __construct
  *
  * @param string $type
  * @param string $message
  */
 public function __construct($type, $message, \Exception $previousException = null)
 {
     $this->type = $type ?: 'unknow type';
     $message = $message ?: 'no message provided';
     $message = sprintf('%s (%s)', $message, $this->type);
     parent::__construct($message, 0, $previousException);
 }
コード例 #24
0
ファイル: XmlException.php プロジェクト: scriptotek/marc
 public function __construct(array $errors)
 {
     $details = array_map(function (LibXMLError $error) {
         return $error->message;
     }, $errors);
     parent::__construct('Failed loading XML: \\n' . implode('\\n', $details));
 }
コード例 #25
0
 function __construct($message = '', $code = NULL, $previous = NULL)
 {
     if (!$message) {
         $message = "You have exceeded your storage capacity. Please remove some files and try again.";
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #26
0
ファイル: FileException.php プロジェクト: shabbyrobe/defile
 public function __construct($message = null, $code = null)
 {
     if (!$message && isset(static::$messages[$code])) {
         $message = static::$messages[$code];
     }
     parent::__construct($message, $code);
 }
コード例 #27
0
ファイル: CannotGetName.php プロジェクト: Joal01/fof
 public function __construct($message = "", $code = 500, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('LIB_FOF_MODEL_ERR_GET_NAME');
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #28
0
 /**
  * @param UploadState      $state Upload state at time of the exception.
  * @param \Exception|array $prev  Exception being thrown.
  */
 public function __construct(UploadState $state, $prev = null)
 {
     $msg = 'An exception occurred while performing a multipart upload.';
     if (is_array($prev)) {
         $msg = strtr($msg, ['performing' => 'uploading parts to']);
         $msg .= " The following parts had errors:\n";
         /** @var $error AwsException */
         foreach ($prev as $part => $error) {
             $msg .= "- Part {$part}: " . $error->getMessage() . "\n";
         }
     } elseif ($prev instanceof AwsException) {
         switch ($prev->getCommand()->getName()) {
             case 'CreateMultipartUpload':
             case 'InitiateMultipartUpload':
                 $action = 'initiating';
                 break;
             case 'CompleteMultipartUpload':
                 $action = 'completing';
                 break;
         }
         if (isset($action)) {
             $msg = strtr($msg, ['performing' => $action]);
         }
     }
     if (!$prev instanceof \Exception) {
         $prev = null;
     }
     parent::__construct($msg, 0, $prev);
     $this->state = $state;
 }
コード例 #29
0
ファイル: PosixException.php プロジェクト: adispartadev/Pork
 /**
  * Initializes exception.
  *
  * @param string $message Error message.
  * @param int $code Error code.
  * @param \Exception $previous Previous exception.
  * @version 0.0.1
  * @since 0.0.1
  */
 public function __construct($message = null, $code = null, \Exception $previous = null)
 {
     // detect POSIX error info
     $code = isset($code) ? $code : \posix_get_last_error();
     $message = isset($message) ? $message : \posix_strerr($code);
     parent::__construct($message, $code, $previous);
 }
コード例 #30
0
ファイル: AccessForbidden.php プロジェクト: Joal01/fof
 public function __construct($message = "", $code = 403, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN');
     }
     parent::__construct($message, $code, $previous);
 }