reghao 1 год назад
Родитель
Сommit
b417fc479f

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