Commit 8a2e1b61 authored by 以墨为白's avatar 以墨为白 🎧

图片上传-bug优化

parent e3ee1ff4
......@@ -5,11 +5,12 @@ package com.zksy.szpt.exception;
*/
public class NotificationException extends Exception {
//异常信息
private String message;
private final String message;
//构造函数
public NotificationException(String message) {
super(message);
this.message = message;
this.initCause(new Throwable(message));//设置cause,方便获取异常信息
}
}
......@@ -70,7 +70,7 @@ public class ImageUploadService {
xxImgfile.setData(fileContent);
return xxImgfileMapper.insert(xxImgfile);
} catch (Exception e) {
throw new NotificationException(e.getCause().getMessage());
throw new NotificationException(e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
}
// 将文件内容插入数据库
// fileContentMono.flatMap(fileContent -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment