proklung/api-exception-bundle

用于管理API抛出的异常的包

安装: 19

依赖项: 0

建议者: 0

安全: 0

星级: 1

关注者: 1

分支: 0

类型:symfony-bundle

1.0.1 2021-08-08 17:55 UTC

This package is auto-updated.

Last update: 2024-09-09 00:28:21 UTC


README

内部 https://github.com/M6Web/ApiExceptionBundle,经过调整以适应特定需求。

内部

安装

composer require proklung/api-exception-bundle

任何

示例配置文件 (/local/config/packages/m6web_api_exception.yaml)

m6web_api_exception:
  match_all: false
  exceptions:
    Prokl\ApiExceptionBundle\ExampleExceptions\DemoApiBundleException:
      status: 405 # Used for exceptions implements HttpExceptionInterface
      # code: 5286 # Create an unique code for this exception in your API, optional, default to 0 and not displayed
      message: "Example exception"

    Prokl\\ApiExceptionBundle\ExampleExceptions\DemoApiBundleVariableException:
      status: 406 # Used for exceptions implements HttpExceptionInterface
      # code: 5286 # Create an unique code for this exception in your API, optional, default to 0 and not displayed
      message: "Example exception with variable {id}"

    Prokl\\ApiExceptionBundle\ExampleExceptions\DemoUnknownException:
      status: 406 # Used for exceptions implements HttpExceptionInterface
      # code: 5286 # Create an unique code for this exception in your API, optional, default to 0 and not displayed
      message: "Example exception with errors"