phisys / exceptions-bundle
用于phisys/exceptions集成的Symfony包。
v1.0.0
2021-04-28 09:34 UTC
Requires
- php: ^7.4|^8
- phisys/exceptions: ^1
- symfony/dependency-injection: ^4.4.1|^5.0.1
- symfony/http-kernel: ^4.4
Requires (Dev)
- phisys/coding-standard: dev-master
This package is auto-updated.
Last update: 2024-09-28 17:07:27 UTC
README
用于phisys/exceptions集成的Symfony包。
ApiExceptionListener
默认情况下,通过使用api异常状态码作为http状态码,替换Symfony标准异常响应为JsonResponse。
JsonResponse有效载荷示例
{ "message": "An error has occurred", "error_code": 40001123 }
您可以通过定义服务ID "PhiSYS\ExceptionsBundle\Http\Service\ApiResponseLoader"
,实现自己的ApiResponseLoader,使用不同的json结构,甚至不同的响应实现。