mirror of
https://gitee.com/lxp135/minio-plus.git
synced 2025-12-06 08:58:25 +08:00
添加异常处理逻辑。
This commit is contained in:
parent
e5d404baa3
commit
7861d61946
@ -23,6 +23,7 @@ public enum MinioPlusErrorCode {
|
||||
FILE_UPLOAD_FAILED(1006,"文件上传失败"),
|
||||
FILE_PREVIEW_WRITE_FAILED(1007,"缩略图生成失败"),
|
||||
FILE_ICON_FAILED(1008,"图标获取失败"),
|
||||
FILE_CREATE_FAILED(1009,"文件创建失败"),
|
||||
|
||||
/**
|
||||
* MinIO 异常
|
||||
|
||||
@ -434,9 +434,16 @@ public class StorageEngineServiceImpl implements StorageEngineService {
|
||||
|
||||
@Override
|
||||
public Boolean createFile(FileMetadataInfoSaveDTO saveDTO, byte[] fileBytes) {
|
||||
// 写入文件
|
||||
@Cleanup ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes);
|
||||
return createFile(saveDTO, inputStream);
|
||||
try{
|
||||
// 写入文件
|
||||
@Cleanup ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes);
|
||||
return createFile(saveDTO, inputStream);
|
||||
}catch (Exception e) {
|
||||
// 打印日志
|
||||
log.error(e.getMessage(), e);
|
||||
// 文件创建失败
|
||||
throw new MinioPlusException(MinioPlusErrorCode.FILE_CREATE_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user