aws-spend-summary 0.2.0.3 → 0.3.0.0
raw patch · 3 files changed
+13/−5 lines, 3 files
Files
- CHANGELOG.md +3/−0
- aws-spend-summary.cabal +1/−1
- src/AwsSpendSummary.hs +9/−4
CHANGELOG.md view
@@ -1,2 +1,5 @@ # Revision history for awsspendsummary +## 0.3.0.0++- Slightly improved error reporting
aws-spend-summary.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: aws-spend-summary-version: 0.2.0.3+version: 0.3.0.0 synopsis: Extract recent daily AWS costs description:
src/AwsSpendSummary.hs view
@@ -12,7 +12,7 @@ import Amazonka.Data.Body (_ResponseBody) import Amazonka.S3.GetObject (newGetObject, getObjectResponse_body) import Amazonka.S3.Internal (BucketName(..), ObjectKey(..))-import Amazonka (_ServiceError, discover, newEnv, serviceError_status, sendEither)+import Amazonka (ErrorCode(ErrorCode), _ServiceError, discover, newEnv, serviceError_code, serviceError_status, sendEither) import Codec.Compression.GZip (decompress) import Conduit ((.|), foldC, liftIO, runConduit, runResourceT) import Control.Lens ((^.), (^?), over, set)@@ -109,9 +109,14 @@ <> "results for " <> mnthStr <> " which might be because " <> "no report exists for this month yet."- _ -> error $- "Could not retrieve results from: " <> show fullPath- <> "\n" <> show e+ _ -> case e ^? _ServiceError . serviceError_code of+ Just (ErrorCode "AccessDenied") ->+ error $ "Access denied to bucket: "+ <> unpack bucketName+ <> ". Please check your permissions and that the bucket exists."+ _ -> error $+ "Could not retrieve results from: " <> show fullPath+ <> "\n" <> show e return Data.Vector.empty Right res -> do rawCsv <- decompress . LBS.fromStrict <$> runConduit (