From c029fc8c3c7a79adb6c6fef745c91250d9e80c84 Mon Sep 17 00:00:00 2001 From: 101 Date: Sun, 18 Feb 2024 23:38:30 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/daemawiki/global/error/ErrorCode.java | 2 +- .../exception/h500/FileUploadFaildException.java | 13 +++++++++++++ .../exception/h500/ImageUploadFaildException.java | 13 ------------- .../daemawiki/infra/s3/service/S3UploadObject.java | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/example/daemawiki/global/exception/h500/FileUploadFaildException.java delete mode 100644 src/main/java/com/example/daemawiki/global/exception/h500/ImageUploadFaildException.java diff --git a/src/main/java/com/example/daemawiki/global/error/ErrorCode.java b/src/main/java/com/example/daemawiki/global/error/ErrorCode.java index ce48277e..135dddfd 100644 --- a/src/main/java/com/example/daemawiki/global/error/ErrorCode.java +++ b/src/main/java/com/example/daemawiki/global/error/ErrorCode.java @@ -24,7 +24,7 @@ public enum ErrorCode { MAIL_CONFIRM_FAILED(500, "메일 전송 실패 (서버 오류)"), TOKEN_REISSUE_FAILED(500, "토큰 재발급 실패"), - IMAGE_UPLOAD_FAILED(500, "이미지 생성 실패ㅋ"), + FILE_UPLOAD_FAILED(500, "파일 업로드 실패ㅋ"), TEST(400, "TEST"); diff --git a/src/main/java/com/example/daemawiki/global/exception/h500/FileUploadFaildException.java b/src/main/java/com/example/daemawiki/global/exception/h500/FileUploadFaildException.java new file mode 100644 index 00000000..041f2c93 --- /dev/null +++ b/src/main/java/com/example/daemawiki/global/exception/h500/FileUploadFaildException.java @@ -0,0 +1,13 @@ +package com.example.daemawiki.global.exception.h500; + +import com.example.daemawiki.global.error.ErrorCode; +import com.example.daemawiki.global.error.exception.CustomException; + +public class FileUploadFaildException extends CustomException { + public static final CustomException EXCEPTION = new FileUploadFaildException(); + + private FileUploadFaildException() { + super(ErrorCode.FILE_UPLOAD_FAILED); + } + +} diff --git a/src/main/java/com/example/daemawiki/global/exception/h500/ImageUploadFaildException.java b/src/main/java/com/example/daemawiki/global/exception/h500/ImageUploadFaildException.java deleted file mode 100644 index e5bf981b..00000000 --- a/src/main/java/com/example/daemawiki/global/exception/h500/ImageUploadFaildException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.daemawiki.global.exception.h500; - -import com.example.daemawiki.global.error.ErrorCode; -import com.example.daemawiki.global.error.exception.CustomException; - -public class ImageUploadFaildException extends CustomException { - public static final CustomException EXCEPTION = new ImageUploadFaildException(); - - private ImageUploadFaildException() { - super(ErrorCode.IMAGE_UPLOAD_FAILED); - } - -} diff --git a/src/main/java/com/example/daemawiki/infra/s3/service/S3UploadObject.java b/src/main/java/com/example/daemawiki/infra/s3/service/S3UploadObject.java index d6e1317a..2b29bb3e 100644 --- a/src/main/java/com/example/daemawiki/infra/s3/service/S3UploadObject.java +++ b/src/main/java/com/example/daemawiki/infra/s3/service/S3UploadObject.java @@ -4,7 +4,7 @@ import com.example.daemawiki.domain.file.model.FileDetail; import com.example.daemawiki.domain.file.model.type.FileType; import com.example.daemawiki.domain.file.repository.FileRepository; -import com.example.daemawiki.global.exception.h500.ImageUploadFaildException; +import com.example.daemawiki.global.exception.h500.FileUploadFaildException; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.http.MediaType; @@ -80,7 +80,7 @@ public Mono uploadObject(FilePart filePart, String fileType) { return s3AsyncClient.completeMultipartUpload(completeRequest); }) - .onErrorMap(e -> ImageUploadFaildException.EXCEPTION); + .onErrorMap(e -> FileUploadFaildException.EXCEPTION); }); }) .flatMap(response -> createFile(key, filename, type, fileType));