GithubHelp home page GithubHelp logo

Comments (6)

bilulanlv avatar bilulanlv commented on June 12, 2024

已经pr了。
升级差点出了大问题。

from webman-exception.

bilulanlv avatar bilulanlv commented on June 12, 2024

我看到了这个更改。c099850
为什么只有BaseException的时候才用异常的errorCode。如果之前的业务有使用其他异常自定义errorCode,并且需要靠errorCode判断后面的逻辑,那就会全盘出问题。

from webman-exception.

bilulanlv avatar bilulanlv commented on June 12, 2024

v1.5.0版本,如何让UnauthorizedHttpException抛出自定义的错误errorCode呢?

from webman-exception.

Tinywan avatar Tinywan commented on June 12, 2024

通过第二个参数数组

throw new UnauthorizedHttpException('无效的授权码', ['errorCode' => '我的自定义的错误errorCode']);

from webman-exception.

bilulanlv avatar bilulanlv commented on June 12, 2024

从1.3.4起,这个更改已经将errorCode写死了, $bodyKey[0] ?? 'code' => $bodyValue[0] ?? 0,

通过第二个参数数组
throw new UnauthorizedHttpException('无效的授权码', ['errorCode' => 30001]);
这样只会显示,你可以自己测试一下。
{
"error_code": 200,
"msg": "无效的授权码",
"data": {}
}

from webman-exception.

Tinywan avatar Tinywan commented on June 12, 2024

你昨天提交的PR我看已经修复了是不

from webman-exception.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.