Commit 062185e8 authored by 王源's avatar 王源 🎧

添加异常处理配置

parent 85801d31
...@@ -15,10 +15,24 @@ class ConfigProvider ...@@ -15,10 +15,24 @@ class ConfigProvider
public function __invoke(): array public function __invoke(): array
{ {
return [ return [
'exceptions' => [
'handler' => [
'http' => [
\Meibuyu\Micro\Exceptions\Handler\MicroExceptionHandler::class,
],
],
],
'commands' => [ 'commands' => [
\Meibuyu\Micro\Command\RepositoryCommand::class, \Meibuyu\Micro\Command\RepositoryCommand::class,
\Meibuyu\Micro\Command\ValidatorCommand::class, \Meibuyu\Micro\Command\ValidatorCommand::class,
], ],
'annotations' => [
'scan' => [
'paths' => [
__DIR__,
],
],
],
]; ];
} }
......
...@@ -20,7 +20,6 @@ use Throwable; ...@@ -20,7 +20,6 @@ use Throwable;
class MicroExceptionHandler extends ExceptionHandler class MicroExceptionHandler extends ExceptionHandler
{ {
public function handle(Throwable $throwable, ResponseInterface $response) public function handle(Throwable $throwable, ResponseInterface $response)
{ {
// 判断被捕获到的异常是希望被捕获的异常 // 判断被捕获到的异常是希望被捕获的异常
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment