承接 yolo/errors 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yolo/errors

最新稳定版本:v1.0.3

Composer 安装命令:

composer require yolo/errors

包简介

A package for yolo errors

README 文档

README

An error handling package for the yolo microservices framework.

Usage

  • Register error module and types.

    $registry = \Yolo\Errors\ExceptionRegistry::inst();
    $registry->createExceptionRegistry(
      'user.service.com',
      [
          'user' => [
              'index' => Number::createIncreaseCodeIndex(1000000)
          ]
      ]
    );
    
  • Register an error

    $registry->register(
      (new \Yolo\Errors\ResponseError('user', 'user_not_found', 'User not found.'))->setHttpStatus(404)
    );
    
  • Throw a new error

    throw \Yolo\Service\ApiGateway::responseError('user_not_found', [
      'userId' => 123,
    ]);
    

It will throw a YoloException, which will be caught and handled by the framework and returned.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-08