File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/org/ezcode/codetest/infrastructure/s3 Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1010import org .springframework .web .multipart .MultipartFile ;
1111
1212import com .amazonaws .services .s3 .AmazonS3 ;
13+ import com .amazonaws .services .s3 .model .AmazonS3Exception ;
1314import com .amazonaws .services .s3 .model .ObjectMetadata ;
1415
1516import lombok .RequiredArgsConstructor ;
@@ -51,6 +52,21 @@ public String upload(MultipartFile multipartFile, String dirName) {
5152 return result ;
5253
5354 } catch (IOException e ) {
55+ log .error ("S3 업로드 중 IO 오류 발생" ,e );
56+ throw new S3Exception (
57+ S3ExceptionCode .S3_UPLOAD_FAILED ,
58+ S3ExceptionCode .S3_UPLOAD_FAILED .getStatus (),
59+ S3ExceptionCode .S3_UPLOAD_FAILED .getMessage ()
60+ );
61+ } catch (AmazonS3Exception e ) {
62+ log .error ("S3 서비스 오류 발생: {}" , e .getErrorMessage (), e );
63+ throw new S3Exception (
64+ S3ExceptionCode .S3_UPLOAD_FAILED ,
65+ S3ExceptionCode .S3_UPLOAD_FAILED .getStatus (),
66+ S3ExceptionCode .S3_UPLOAD_FAILED .getMessage ()
67+ );
68+ } catch (Exception e ) {
69+ log .error ("예상치 못한 업로드 오류 발생" , e );
5470 throw new S3Exception (
5571 S3ExceptionCode .S3_UPLOAD_FAILED ,
5672 S3ExceptionCode .S3_UPLOAD_FAILED .getStatus (),
You can’t perform that action at this time.
0 commit comments