You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
521 B
PHTML
24 lines
521 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace App\Exception;
|
||
|
|
||
|
use App\Constants\ResultCode;
|
||
|
use Hyperf\Server\Exception\ServerException;
|
||
|
use Throwable;
|
||
|
|
||
|
abstract class BasicException extends ServerException
|
||
|
{
|
||
|
protected $code = ResultCode::DEFAULT_ERROR;
|
||
|
|
||
|
public function __construct(string $message = null, Throwable $previous = null)
|
||
|
{
|
||
|
if (is_null($message)) {
|
||
|
$message = ResultCode::getMessage($this->code);
|
||
|
}
|
||
|
|
||
|
parent::__construct($message, $this->code, $previous);
|
||
|
}
|
||
|
}
|