瀏覽代碼

update MediaFileProcessor

reghao 1 年之前
父節點
當前提交
b417fc479f
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      oss-store/src/main/java/cn/reghao/oss/store/task/MediaFileProcessor.java

+ 6 - 3
oss-store/src/main/java/cn/reghao/oss/store/task/MediaFileProcessor.java

@@ -48,7 +48,8 @@ public class MediaFileProcessor {
     public VideoInfo getVideoInfo(String videoFileId) throws Exception {
         ObjectMeta objectMeta = objectRepository.getObjectMetaById(videoFileId);
         if (objectMeta == null) {
-            return null;
+            String errMsg = String.format("%s not exist in oss-store", videoFileId);
+            throw new Exception(errMsg);
         }
 
         String absolutePath = objectMeta.getAbsolutePath();
@@ -92,7 +93,8 @@ public class MediaFileProcessor {
     public ImageInfo getImageInfo(String imageFileId) throws Exception {
         ObjectMeta objectMeta = objectRepository.getObjectMetaById(imageFileId);
         if (objectMeta == null) {
-            return null;
+            String errMsg = String.format("%s not exist in oss-store", imageFileId);
+            throw new Exception(errMsg);
         }
 
         String absolutePath = objectMeta.getAbsolutePath();
@@ -169,7 +171,8 @@ public class MediaFileProcessor {
     public AudioInfo getAudioInfo(String audioFileId) throws Exception {
         ObjectMeta objectMeta = objectRepository.getObjectMetaById(audioFileId);
         if (objectMeta == null) {
-            return null;
+            String errMsg = String.format("%s not exist in oss-store", audioFileId);
+            throw new Exception(errMsg);
         }
 
         String absolutePath = objectMeta.getAbsolutePath();