Преглед на файлове

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();