提交服务端基础框架
This commit is contained in:
47
Server/vendor/alibabacloud/tea/src/Exception/TeaError.php
vendored
Executable file
47
Server/vendor/alibabacloud/tea/src/Exception/TeaError.php
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Tea\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class TeaError.
|
||||
*/
|
||||
class TeaError extends RuntimeException
|
||||
{
|
||||
public $message = '';
|
||||
public $code = 0;
|
||||
public $data;
|
||||
public $name = '';
|
||||
private $errorInfo;
|
||||
|
||||
/**
|
||||
* TeaError constructor.
|
||||
*
|
||||
* @param array $errorInfo
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param null|\Throwable $previous
|
||||
*/
|
||||
public function __construct($errorInfo = [], $message = '', $code = 0, $previous = null)
|
||||
{
|
||||
parent::__construct((string) $message, (int) $code, $previous);
|
||||
$this->errorInfo = $errorInfo;
|
||||
if (!empty($errorInfo)) {
|
||||
$properties = ['name', 'message', 'code', 'data'];
|
||||
foreach ($properties as $property) {
|
||||
if (isset($errorInfo[$property])) {
|
||||
$this->{$property} = $errorInfo[$property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getErrorInfo()
|
||||
{
|
||||
return $this->errorInfo;
|
||||
}
|
||||
}
|
||||
21
Server/vendor/alibabacloud/tea/src/Exception/TeaRetryError.php
vendored
Executable file
21
Server/vendor/alibabacloud/tea/src/Exception/TeaRetryError.php
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Tea\Exception;
|
||||
|
||||
/**
|
||||
* Class TeaRetryError.
|
||||
*/
|
||||
class TeaRetryError extends TeaError
|
||||
{
|
||||
/**
|
||||
* TeaRetryError constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param null|\Throwable $previous
|
||||
*/
|
||||
public function __construct($message = '', $code = 0, $previous = null)
|
||||
{
|
||||
parent::__construct([], $message, $code, $previous);
|
||||
}
|
||||
}
|
||||
41
Server/vendor/alibabacloud/tea/src/Exception/TeaUnableRetryError.php
vendored
Executable file
41
Server/vendor/alibabacloud/tea/src/Exception/TeaUnableRetryError.php
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Tea\Exception;
|
||||
|
||||
use AlibabaCloud\Tea\Request;
|
||||
|
||||
/**
|
||||
* Class TeaUnableRetryError.
|
||||
*/
|
||||
class TeaUnableRetryError extends TeaError
|
||||
{
|
||||
private $lastRequest;
|
||||
private $lastException;
|
||||
|
||||
/**
|
||||
* TeaUnableRetryError constructor.
|
||||
*
|
||||
* @param Request $lastRequest
|
||||
* @param null|\Exception $lastException
|
||||
*/
|
||||
public function __construct($lastRequest, $lastException = null)
|
||||
{
|
||||
$error_info = [];
|
||||
if (null !== $lastException && $lastException instanceof TeaError) {
|
||||
$error_info = $lastException->getErrorInfo();
|
||||
}
|
||||
parent::__construct($error_info, $lastException->getMessage(), $lastException->getCode(), $lastException);
|
||||
$this->lastRequest = $lastRequest;
|
||||
$this->lastException = $lastException;
|
||||
}
|
||||
|
||||
public function getLastRequest()
|
||||
{
|
||||
return $this->lastRequest;
|
||||
}
|
||||
|
||||
public function getLastException()
|
||||
{
|
||||
return $this->lastException;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user