From 76d7bd911d5d4f8e32b691d23d04eac11e3d094e Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 8 Apr 2017 15:33:57 -0700 Subject: [PATCH] Include cause when throwing S3Exception --- src/main/java/org/gaul/s3proxy/S3ProxyHandler.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java index 43dd2f3..ce233ad 100644 --- a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java +++ b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java @@ -408,8 +408,8 @@ public class S3ProxyHandler { try { authHeader = new S3AuthorizationHeader(headerAuthorization); - } catch (IllegalArgumentException e) { - throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT); + } catch (IllegalArgumentException iae) { + throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT, iae); } requestIdentity = authHeader.identity; } @@ -510,7 +510,7 @@ public class S3ProxyHandler { baseRequest, authHeader, payload, uriForSigning, credential); } catch (InvalidKeyException | NoSuchAlgorithmException e) { - throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT); + throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT, e); } } @@ -1474,7 +1474,8 @@ public class S3ProxyHandler { try { blob = blobStore.getBlob(containerName, blobName, options); } catch (IllegalArgumentException iae) { - throw new S3Exception(S3ErrorCode.INVALID_RANGE); + // TODO: correct mapping? + throw new S3Exception(S3ErrorCode.INVALID_RANGE, iae); } if (blob == null) { throw new S3Exception(S3ErrorCode.NO_SUCH_KEY);