Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apijson 调试模式, 批量新增、修改等操作,异常情况无法返回错误信息 #462

Open
cloudAndMonkey opened this issue Nov 7, 2022 · 1 comment
Labels

Comments

@cloudAndMonkey
Copy link
Contributor

cloudAndMonkey commented Nov 7, 2022

image
正确结果:
image
原因分析:
这个错误,是apijson的bug, 调试情况, 堆栈信息,无法转化为json字符串.
image
image
建议:
屏蔽: 感觉没有太大必要,前端把这些堆栈信息打印出来
// if (error != null) {
// res.put("trace:throw", error.getClass().getName());
// res.put("trace:stack", error.getStackTrace());
// }

@TommyLemon
Copy link
Collaborator

TommyLemon commented Nov 10, 2022

为了方便后端调试 bug。
不过既然有这个问题,可以通过新增一个

public static boolean IS_RETURN_STACK_TRACE = true; 

来标记是否返回 "trace:stack"。

原先想着可以先

String traceStr = JSON.toJSONString(error.getStackTrace());

判断是否返回正常有内容的 "[...]",没有的话说明有报错,就不再返回,有就

res.put("trace:stack", JSON.parseArray(traceStr));

放进去返回,但这样做就浪费不少性能,或许没必要。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants