fix(note): 处理笔记保存失败异常
- 在保存笔记失败时抛出 NOTE_PUBLISH_FAIL 异常 - 修复 ResponseCodeEnum 中重复分号问题
This commit is contained in:
@@ -18,7 +18,6 @@ public enum ResponseCodeEnum implements BaseExceptionInterface {
|
||||
NOTE_NOT_FOUND("NOTE-20002", "笔记不存在"),
|
||||
NOTE_PRIVATE("NOTE-20003", "作者已将该笔记设置为仅自己可见"),
|
||||
;
|
||||
;
|
||||
|
||||
// 异常码
|
||||
private final String errorCode;
|
||||
|
||||
@@ -154,6 +154,9 @@ public class NoteServiceImpl extends ServiceImpl<NoteDOMapper, NoteDO> implement
|
||||
.build();
|
||||
try {
|
||||
boolean isSaveSuccess = this.save(noteDO);
|
||||
if (!isSaveSuccess) {
|
||||
throw new ApiException(ResponseCodeEnum.NOTE_PUBLISH_FAIL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存笔记失败!", e);
|
||||
// RPC:调用KV服务,删除笔记内容
|
||||
|
||||
Reference in New Issue
Block a user