Comments (2)
默认情况下,框架是不会携带异常信息的,原因上面已经提过了。
但我们可以通过扩展的方式来实现,将异常信息携带到请求端,如下:
框架在 ActionMethodResultWrap 时,已经把异常信息存放到 flowContext.option(FlowAttr.msgException, msgException.getMessage()) 中了。
之后我们重写一个 ActionAfter 类,并配置到业务框架中,把默认的实现 DefaultActionAfter 替换就可以了。
重写的 ActionAfter 实现类中,将这个异常信息在发送之前保存到 response 中就可以。
public final class MyActionAfter implements ActionAfter {
... ... 省略部分代码
@Override
public void execute(final FlowContext flowContext) {
... ... 省略部分代码
// 有错误就响应给调用方
if (response.hasError()) {
// 异常消息发送到请求端
String msg = flowContext.option(FlowAttr.msgException);
response.setValidatorMsg(msg);
asyncCtx.sendResponse(response);
return;
}
... ... 省略部分代码
}
}
from iogame.
see https://www.yuque.com/iohao/game/avlo99#G4cvL
from iogame.
Related Issues (20)
- 建议未来支持高性能序列化框架-flatbuffers和simple-binary-encoding HOT 5
- 框架里面使用的很多第三方jar 包太老了是否可以统一升级一下 HOT 6
- AbstractUserSessions.userIdMap安全删除 HOT 3
- 随着通讯时间的增加,导致linux服务器系统的线程数用完。 HOT 2
- IDEA没问题,打包后启动报错 HOT 7
- WebSocketVerifyHandler使用 HOT 4
- 在测试的时候遇到一个报错 HOT 1
- GameFlowEo的FlowContext可以不是必须的吗 HOT 2
- GameFlowContext的getRoom可以改成返回泛型吗 HOT 2
- [对接文档] 增强对接文档的扩展性,提供方便获取 action 、广播、错误码 ...等相关文档的信息,以便个性化扩展。 HOT 1
- SDK C# ,客户端代码生成;方便 Unity、Godot 对接。
- SDK TypeScript 客户端代码生成;方便 CocosCeator、或其他支持 TypeScript 的客户端对接。
- [对接文档] 增强,支持对接文档生成与扩展,包括文本文档生成、联调代码生成 ...等 HOT 1
- 测试用例跑不通 HOT 3
- 对外服高频率报错 HOT 2
- 对外服高频率报错: io.netty.channel.unix.Errors$NativeIoException: recvAddress(..) failed: Connection reset by peer 17:18:08.579 [iohao.com:external-netty-server-worker-7] WARN io.netty.channel.DefaultChannelPipeline -- An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. HOT 2
- 顶号操作疑似bug HOT 7
- 关于 StatActionInOut.TimeRange 的 inRange(long time) 方法的准确性 HOT 5
- 获取所有活跃用户 HOT 4
- 获取活跃机器 HOT 3
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 iogame.