Пример #1
0
 public function __construct($entityTypeID = 0, $entityID = 0, $roleID = 0, $code = 0, $file = '', $line = 0, \Exception $previous = null)
 {
     $this->entityTypeID = $entityTypeID;
     $this->entityID = $entityID;
     $this->roleID = $roleID;
     $name = 'Entity';
     if ($this->roleID === EntityMerger::ROLE_SEED) {
         $name = 'Seed entity';
     } elseif ($this->roleID === EntityMerger::ROLE_TARG) {
         $name = 'Target entity';
     }
     if ($code === self::READ_DENIED) {
         $message = "{$name} [{$entityID}] read permission denied";
     } elseif ($code === self::UPDATE_DENIED) {
         $message = "{$name} [{$entityID}] update permission denied";
     } elseif ($code === self::DELETE_DENIED) {
         $message = "{$name} [{$entityID}] delete permission denied";
     } elseif ($code === self::NOT_FOUND) {
         $message = "{$name} [{$entityID}] is not found";
     } elseif ($code === self::UPDATE_FAILED) {
         $message = "{$name} [{$entityID}] update operation failed";
     } elseif ($code === self::DELETE_FAILED) {
         $message = "{$name} [{$entityID}] delete operation failed";
     } else {
         $message = 'General error';
     }
     parent::__construct($message, $code, $file, $line, $previous);
 }
Пример #2
0
 /**
  * @param string $message The message to be shown in trace. If set to false, the default message for this class of exception will be used.
  * @param mixed[] $data An array of special data. Could be:
  * 		<li>AUX MESSAGE string|mixed[] String to be attached to the end of the message in round brackets
  * 		<li>AUX ERROR mixed[] An array structure to be dumped with AddMessage2Log(), accompanied with unique-exception-id to be able to establish matching
  * 		<li>ERROR \Bitrix\Tasks\Util\Error\Collection|string[] A collection or string array of high-level errors to show to user
  * @param mixed[] $additional Some additional things, usually unused
  */
 public function __construct($message = false, array $data = array(), array $additional = array())
 {
     if (!empty($data)) {
         $this->data = $data;
     }
     if (!empty($additional)) {
         $this->additional = $additional;
     }
     if ($message === false) {
         $message = $this->getDefaultMessage();
     }
     $this->messageOrigin = $message;
     if (!isset($additional['FILE'])) {
         $additional['FILE'] = '';
     }
     $additional['LINE'] = intval($additional['LINE']);
     $additional['CODE'] = intval($additional['CODE']);
     if (!isset($additional['PREVIOUS_EXCEPTION'])) {
         $additional['PREVIOUS_EXCEPTION'] = null;
     }
     $doDump = $this->dumpAuxError();
     if ($doDump) {
         $exceptionId = uniqid('', true);
         if (isset($this->data['AUX']['ERROR'])) {
             if (!is_array($this->data['AUX']['ERROR'])) {
                 $this->data['AUX']['ERROR'] = array((string) $this->data['AUX']['ERROR']);
             }
             AddMessage2Log('Exception additional data: ' . $exceptionId . ': ' . serialize($this->data['AUX']['ERROR']), 'tasks');
         }
     }
     parent::__construct(($doDump ? $exceptionId . ': ' : '') . $this->prepareMessage($message), $additional['CODE'], $additional['FILE'], $additional['LINE'], $additional['PREVIOUS_EXCEPTION']);
 }
Пример #3
0
 /**
  * @param string $message Application message.
  * @param string $databaseMessage Database reason.
  * @param \Exception $previous The previous exception used for the exception chaining.
  */
 public function __construct($message = "", $databaseMessage = "", \Exception $previous = null)
 {
     if ($message != "" && $databaseMessage != "") {
         $message .= ": " . $databaseMessage;
     } elseif ($message == "" && $databaseMessage != "") {
         $message = $databaseMessage;
     }
     $this->databaseMessage = $databaseMessage;
     parent::__construct($message, 400, '', 0, $previous);
 }
Пример #4
0
	public function __construct(array $queryResult, \Exception $previous = null)
	{
		$errorMessage = $queryResult['error_str'];
		if(strlen($errorMessage) > 0 && strlen($queryResult['error_detail']) > 0)
		{
			$errorMessage .= ": ";
		}
		$errorMessage .= $queryResult['error_detail'];

		parent::__construct($errorMessage, $queryResult['error_code']);
	}
Пример #5
0
 public function __construct(array $queryResult, \Exception $previous = null)
 {
     $errorMessage = $queryResult['error'];
     if (strlen($errorMessage) > 0 && strlen($queryResult['error_description']) > 0) {
         $errorMessage .= ": ";
     }
     $errorMessage .= $queryResult['error_description'];
     if (intval($queryResult['error']) > 0) {
         parent::__construct($errorMessage, intval($queryResult['error']));
     } else {
         parent::__construct($errorMessage);
     }
 }
 public function __construct(array $field, \CApplicationException $error, $code = 0, $file = '', $line = 0, \Exception $previous = null)
 {
     $this->field = $field;
     $this->error = $error;
     if ($code === self::CREATE_FAILED) {
         $name = isset($field['FIELD_NAME']) ? $field['FIELD_NAME'] : '';
         $typeName = isset($field['USER_TYPE_ID']) ? $field['USER_TYPE_ID'] : '';
         $entityType = isset($field['ENTITY_ID']) ? $field['ENTITY_ID'] : '';
         $message = "Could not create user field (name: '{$name}', type: '{$typeName}', entity: '{$entityType}').";
     } else {
         $message = 'General error';
     }
     parent::__construct($message, $code, $file, $line, $previous);
 }
Пример #7
0
 public function __construct($message = '', array $parameters = array())
 {
     if (isset($parameters['INFO'])) {
         $this->info = $parameters['INFO'];
     }
     if ($message === false) {
         $message = $this->getDefaultMessage();
     }
     if (!isset($parameters['FILE'])) {
         $parameters['FILE'] = '';
     }
     $parameters['LINE'] = intval($parameters['LINE']);
     $parameters['CODE'] = intval($parameters['CODE']);
     if (!isset($parameters['PREVIOUS_EXCEPTION'])) {
         $parameters['PREVIOUS_EXCEPTION'] = null;
     }
     parent::__construct($message, $parameters['CODE'], $parameters['FILE'], $parameters['LINE'], $parameters['PREVIOUS_EXCEPTION']);
 }
 public function __construct($srcEntityTypeID = 0, $dstEntityTypeID = 0, $targ = 0, $code = 0, $extMessage = '', $file = '', $line = 0, \Exception $previous = null)
 {
     $this->srcEntityTypeID = $srcEntityTypeID;
     $this->dstEntityTypeID = $dstEntityTypeID;
     $this->targ = $targ;
     if (is_string($extMessage) && $extMessage !== '') {
         $this->extMessage = $extMessage;
     }
     $entityTypeName = ucfirst(\CCrmOwnerType::ResolveName($this->getTargetEntityTypeID()));
     if ($code === self::NOT_FOUND) {
         $message = "The {$entityTypeName} entity is not found.";
     } elseif ($code === self::NOT_SYNCHRONIZED) {
         $message = "The {$entityTypeName} entity user fields are not synchronized.";
     } elseif ($code === self::HAS_WORKFLOWS) {
         $message = "The {$entityTypeName} entity has autostarting workflows.";
     } elseif ($code === self::AUTOCREATION_DISABLED) {
         $message = "Entity autocreation is disabled.";
     } elseif ($code === self::EMPTY_FIELDS) {
         $message = "The {$entityTypeName} entity fields are empty.";
     } elseif ($code === self::INVALID_FIELDS) {
         $message = "The {$entityTypeName} entity fields are invalid.";
     } elseif ($code === self::READ_DENIED) {
         $message = "The {$entityTypeName} entity read is not permitted.";
     } elseif ($code === self::CREATE_DENIED) {
         $message = "The {$entityTypeName} entity creation is not permitted.";
     } elseif ($code === self::CREATE_FAILED) {
         $message = "Could not create a {$entityTypeName} entity.";
     } elseif ($code === self::UPDATE_DENIED) {
         $message = "The {$entityTypeName} entity modification is not permitted.";
     } elseif ($code === self::NOT_SUPPORTED) {
         $message = "The {$entityTypeName} entity type is not supported in current context.";
     } else {
         $message = 'A general error has occurred';
     }
     parent::__construct($message, $code, $file, $line, $previous);
 }
Пример #9
0
 /**
  * Creates new exception object.
  *
  * @param string $message Exception message
  * @param string $path Path that generated exception.
  * @param \Exception $previous
  */
 public function __construct($message = "", $path = "", \Exception $previous = null)
 {
     parent::__construct($message, 120, '', 0, $previous);
     $this->path = $path;
 }
 /**
  * SettingParameterNullException constructor.
  * @param string $parameter
  */
 public function __construct($parameter)
 {
     parent::__construct(sprintf('Argument \'%s\' is null or empty', $parameter));
 }
Пример #11
0
 public function __construct($message = "", \Exception $previous = null)
 {
     parent::__construct($message, 0, '', 0, $previous);
 }
Пример #12
0
 public function __construct($message = "", $code = 0, \Exception $previous = null)
 {
     parent::__construct($message, $code, '', '', $previous);
 }
Пример #13
0
 public function __construct($message = "", $actionParams = array(), \Exception $previous = null)
 {
     parent::__construct($message, 0, '', 0, $previous);
     $this->actionParams = $actionParams;
 }
Пример #14
0
 public function __construct($message = "", $code = 0)
 {
     parent::_construct(strlen($message) ? $message : Loc::getMessage('SALE_TREE_ENTITY_INTERNAL_EXCEPTION'), $code);
 }
Пример #15
0
 /**
  * @param string $message Message to show.
  * @param string  $endPosition Position from witch must be start ed next step.
  * @param \Exception $previous.
  */
 public function __construct($message = "", $endPosition = "", \Exception $previous = null)
 {
     parent::__construct($message, 0, '', 0, $previous);
     $this->endPosition = $endPosition;
 }
Пример #16
0
 /**
  * Creates new exception object.
  *
  * @param string $message
  * @param string $locMessageKey
  * @param int $code
  * @param string $file
  * @param int $line
  * @param \Exception $previous
  */
 public function __construct($message = '', $locMessageKey = '', $code = 0, $file = '', $line = 0, \Exception $previous = null)
 {
     $this->locMessage = $locMessageKey;
     parent::__construct($message, $code, $file, $line, $previous);
 }