mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-03-29 16:10:17 +08:00
fix : update cors and admin user cache
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Exception\Handler;
|
||||
|
||||
use App\Constants\ResultCode;
|
||||
use App\Exception\ErrException;
|
||||
use Hyperf\Validation\ValidationException;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -19,9 +21,11 @@ class ValidationExceptionHandler extends BaseErrExceptionHandler
|
||||
*/
|
||||
public function handle(Throwable $throwable, ResponseInterface $response): ResponseInterface
|
||||
{
|
||||
return $throwable instanceof ValidationException
|
||||
? $this->handlerResponse($throwable, $response)
|
||||
: $response;
|
||||
if ($throwable instanceof ValidationException) {
|
||||
$throwable = new ErrException($throwable->validator->errors()->first(),ResultCode::ERROR);
|
||||
return $this->handlerResponse($throwable,$response);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user