Comments (10)
看下文档:https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-feature/bizstatuserr/
from kitex.
看下文档:https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-feature/bizstatuserr/
我看了这个地方https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-feature/bizstatuserr/,我看提供了 NewBizStatusError 和 FromBizStatusError,但是我kitex端使用 NewBizStatusError 创造的 error,客户端不管怎么 if 都只是 nil,关于这个的用法相关,是否在 github 有案例?
from kitex.
可以收藏和clone下 Kitex-examples :https://github.com/cloudwego/kitex-examples/tree/main/business_exception
from kitex.
https://www.bilibili.com/video/BV1Nm41117Ri 视频中也有讲解,需要设置对应的 MetaHandler
from kitex.
https://www.bilibili.com/video/BV1Nm41117Ri 视频中也有讲解,需要设置对应的
MetaHandler
好的,感谢,我去学习一下!
from kitex.
可以收藏和clone下 Kitex-examples :https://github.com/cloudwego/kitex-examples/tree/main/business_exception
好的
from kitex.
from kitex.
好的,可能是少配置了 MetaHandler, 麻烦各位大佬了
我先去试试
from kitex.
我目前想要为我的自定义 Error 来实现 kerrors.BizStatusErrorIface
这个接口。我的代码这样实现的:
// Error 自定义错误
type Error struct {
Msg string `json:"msg"`
Err error `json:"err"`
}
func NewError(msg string, err error) kerrors.BizStatusErrorIface {
return &Error{Msg: msg, Err: err}
}
func (self *Error) BizStatusCode() int32 {
return 0
}
func (self *Error) BizMessage() string {
return self.Msg
}
func (self *Error) BizExtra() map[string]string {
return map[string]string{
"msg": self.Msg,
"error": self.Err.Error(),
}
}
func (self *Error) Error() string {
return self.Err.Error()
}
但是好像无法进行正常传输
from kitex.
业务异常状态码不能为0,否则无法识别为业务异常
from kitex.
Related Issues (20)
- Feature Proposal: Allow custom registry to get the actual address for registering HOT 3
- Feature Proposal: optionloader for Kitex client/server HOT 5
- Feature Proposal: kitexcall command for sending json generic requests HOT 5
- 客户端访问服务出现 cannot assign requested address HOT 5
- kitex自定义脚手架模板里想获得hello.thrift里namespace怎么获得 HOT 4
- kitex会考虑和wego一样模版内置sprig函数吗? HOT 1
- Remove Go version restrictions for newer versions HOT 5
- 请求帮助:kitex 单 Server 多 Service HOT 14
- 篡改自定义nacos注册信息 HOT 3
- 自定义模板生成报错 HOT 1
- WithCodec 似乎没生效
- 通过jmeter压测工具调用服务端报错:no kitex compressor registered found for:gzip HOT 2
- 会不会支持最新版本的 thrift HOT 1
- thrift 好像不兼容 HOT 3
- 泛化调用的IDL无法解析官方推荐的字段校验 HOT 4
- 负载均衡没有按权重分流 HOT 6
- Failed to detect current executable: cannot find executable path HOT 3
- 监控server侧回调缺乏信息 HOT 2
- 服务几天没访问后就访问不了了 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kitex.