app.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. return [
  3. 'enable' => true,
  4. // 错误异常配置
  5. 'exception_handler' => [
  6. // 不需要记录错误日志
  7. 'dont_report' => [
  8. Tinywan\ExceptionHandler\Exception\BadRequestHttpException::class,
  9. Tinywan\ExceptionHandler\Exception\UnauthorizedHttpException::class,
  10. Tinywan\ExceptionHandler\Exception\ForbiddenHttpException::class,
  11. Tinywan\ExceptionHandler\Exception\NotFoundHttpException::class,
  12. Tinywan\ExceptionHandler\Exception\RouteNotFoundException::class,
  13. Tinywan\ExceptionHandler\Exception\TooManyRequestsHttpException::class,
  14. Tinywan\ExceptionHandler\Exception\ServerErrorHttpException::class,
  15. Tinywan\Validate\Exception\ValidateException::class,
  16. Tinywan\Jwt\Exception\JwtTokenException::class
  17. ],
  18. // 自定义HTTP状态码
  19. 'status' => [
  20. 'validate' => 400, // 验证器异常
  21. 'jwt_token' => 401, // JWT 认证失败
  22. 'jwt_token_expired' => 402, // JWT 令牌过期
  23. 'server_error' => 500, // 服务器内部错误
  24. ],
  25. // 自定义响应消息
  26. 'body' => [
  27. 'code' => 0,
  28. 'msg' => '服务器内部异常',
  29. 'data' => null
  30. ],
  31. // 事件
  32. 'event' => [
  33. 'enable' => false,
  34. // 钉钉机器人
  35. 'ding_talk' => [
  36. 'accessToken' => 'xxxxxxxxxxxxxxxx',
  37. 'secret' => 'xxxxxxxxxxxxxxxx',
  38. 'title' => '钉钉机器人异常通知',
  39. ]
  40. ],
  41. ],
  42. ];