This commit is contained in:
Aether
2025-09-28 14:51:38 +08:00
parent afd384a52a
commit 10b58a8c6d
8 changed files with 326 additions and 4 deletions

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Aether\RpcException;
use Hyperf\Server\Exception\ServerException;
use Throwable;
class ValidateException extends ServerException
{
/**
* @var int 错误码
*/
protected $code;
/**
* @var array 额外数据
*/
protected array $data = [];
public function __construct(string $message = '', int $code = ErrorCode::PARAM_ERROR, array $data = [], ?Throwable $previous = null)
{
if (empty($message)) {
$message = ErrorCode::getMessage($code);
}
$this->code = $code;
$this->data = $data;
parent::__construct($message, $code, $previous);
}
public function getData(): array
{
return $this->data;
}
}