Skip to content

Commit 101b17d

Browse files
committed
批量新增或批量单独设置修改:解决在执行未抛异常但 updateCount=0 这种未成功执行的情况下不返回具体失败子项的请求内容
1 parent 68bfce0 commit 101b17d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -722,22 +722,21 @@ public void onTableArrayParse(String key, JSONArray valueArray) throws Exception
722722
if (failedCount > 0) {
723723
allResult.put("failedCount", failedCount);
724724
allResult.put("failedIdList", failedIds);
725-
if (firstFailThrow != null) {
726-
if (firstFailThrow instanceof CommonException && firstFailThrow.getCause() != null) {
727-
firstFailThrow = firstFailThrow.getCause();
728-
}
729725

730-
JSONObject failObj = new JSONObject(true);
731-
failObj.put("index", firstFailIndex);
732-
failObj.put(childKey, firstFailReq);
726+
JSONObject failObj = new JSONObject(true);
727+
failObj.put("index", firstFailIndex);
728+
failObj.put(childKey, firstFailReq);
733729

734-
JSONObject obj = AbstractParser.extendErrorResult(failObj, firstFailThrow, parser.isRoot());
735-
if (Log.DEBUG) {
736-
obj.put("trace:throw", firstFailThrow.getClass().getName());
737-
obj.put("trace:stack", firstFailThrow.getStackTrace());
738-
}
739-
allResult.put("firstFailed", obj);
730+
if (firstFailThrow instanceof CommonException && firstFailThrow.getCause() != null) {
731+
firstFailThrow = firstFailThrow.getCause();
740732
}
733+
JSONObject obj = firstFailThrow == null ? failObj : AbstractParser.extendErrorResult(failObj, firstFailThrow, parser.isRoot());
734+
if (Log.DEBUG && firstFailThrow != null) {
735+
obj.put("trace:throw", firstFailThrow.getClass().getName());
736+
obj.put("trace:stack", firstFailThrow.getStackTrace());
737+
}
738+
739+
allResult.put("firstFailed", obj);
741740
}
742741
allResult.put(JSONResponse.KEY_COUNT, allCount);
743742
allResult.put(idKey + "[]", ids);

0 commit comments

Comments
 (0)