AndLinker
AndLinker copied to clipboard
关于异常日志打印
// MethodExecutor.java
Response execute(Object[] args) {
Object result = null;
int statusCode = Response.STATUS_CODE_SUCCESS;
String resultMsg = String.format("Call method '%s' successfully!", mMethod.getName());
Throwable throwable = null;
try {
result = mMethod.invoke(mTarget, args);
} catch (IllegalAccessException e) {
statusCode = Response.STATUS_CODE_ILLEGAL_ACCESS;
throwable = e;
} catch (InvocationTargetException e) {
statusCode = Response.STATUS_CODE_INVOCATION_FAIL;
throwable = e;
}
if (throwable != null) {
resultMsg = "Exception occur when execute method:" + mMethod.getName() + '\n' + throwable.getMessage();
// 增加
throwable.printStackTrace();
}
return new Response(statusCode, resultMsg, result);
}
// 增加 throwable.printStackTrace(); 建议这里加上异常堆栈打印,方便定位异常问题
应该直接给他发pull request