From a2406d69d522adeea314e90ab05cbe4e1808a153 Mon Sep 17 00:00:00 2001 From: jinno Yun Date: Wed, 9 Oct 2024 17:55:55 +0900 Subject: [PATCH] =?UTF-8?q?#21=20feat:=20S3UploadException=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compileJava/previous-compilation-data.bin | Bin 2183299 -> 2183299 bytes .../web3/exception/S3/S3UploadException.java | 8 ++++++++ .../s3Storage/service/S3StorageService.java | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 web3-credential-server/src/main/java/web3/exception/S3/S3UploadException.java diff --git a/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin b/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin index ec6e5d8e5633626711a0d075a2cc0a928f40be3a..e92ca77180588b0c9963f709b134df79c982e878 100644 GIT binary patch delta 509 zcmZo(*vi-p#2W;e1uk@N+@|?tLG&-%XeJvDzp~AW%GrHSQLoGfLI)eC4g8Gh^2s78i-|pSQd!ofLMOJ0;|HRYKgB`!sfWKT<6t(Z}-?F z)H&^fhop?X8js)hM-2*JSOvbR|Ep;*J2bD0&CK{+nkC!zXKe~!nFXHRj?TZ%xBD|l zC&+~Due%g1SS4VpriV{+N%yrBi#uY$!lmcdvfX-uf&(Lm?YZufJ0|P5ZEv2aFqKc> z)aq9Y-dB6eH5RAc`RM*!X1m4$1s`UPhR(nLN(3T~ZLe9Z@LiZ={iI?Urz2(!+pD)L zL$j*LlBQ37ez+-tMtU zsB@aV8js%v4@sHrj~W!dunIJo9h&z|{a?+yG)uNFHZ$Yx&)O8eG7ErofOKBx+x_|3 z?dbgNue%g1SS4VpriV{+;nH(!i92G!lJ09Mw%vMyf&(MR9h3FjY|nL zqx*B2#^SU)@2kD#POW~mV7tZw1s`UP5`l4;gw`boty+pD)L zLi=1OOn1A=Lj_wFj{TSFnNoDWo!OrGRG~$M!&T{3^2-0skGFs2 yRD8k$b{NP(Fvo3w$){)_C-Uv^{7JIDVym+5ojG~jVp-~;g?;n4>*^|oDFXmt%EZ$E diff --git a/web3-credential-server/src/main/java/web3/exception/S3/S3UploadException.java b/web3-credential-server/src/main/java/web3/exception/S3/S3UploadException.java new file mode 100644 index 0000000..90244b1 --- /dev/null +++ b/web3-credential-server/src/main/java/web3/exception/S3/S3UploadException.java @@ -0,0 +1,8 @@ +package web3.exception.S3; + +public class S3UploadException extends Exception{ + + public S3UploadException(String message) { + super(message); + } +} diff --git a/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java b/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java index f4fbbb2..b208cec 100644 --- a/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java +++ b/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java @@ -13,6 +13,7 @@ import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.*; import web3.domain.wallet.Wallet; +import web3.exception.S3.S3UploadException; import web3.properties.S3Properties; import web3.repository.wallet.WalletRepository; @@ -402,7 +403,7 @@ public void deletePdf(String urlToDelete) { } @Transactional - public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOException { + public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOException,S3UploadException { String pdfUrl = wallet.getPdfUrl(); byte[] originalPdfBytes = getPdf(pdfUrl).readAllBytes(); String fileName = extractKeyFromUrl(pdfUrl); @@ -431,7 +432,7 @@ public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOExc try { uploadToS3(fileName, newMetadata, finalPdfBytes); } catch (S3Exception e) { - throw new IOException("Failed to upload pdf to S3: " + e.getMessage()); + throw new S3UploadException("Failed to upload pdf to S3: " + e.getMessage()); } } }