FIX: AWS S3 errors don't necessarily include a message

FIX: AWS S3 errors don’t necessarily include a message

  • If the error doesn’t have a message, the class name will help
  • example: before: "Failed to download #{filename} because " after: “Failed to download #{filename} because Aws::S3::Errors::NotFound”
diff --git a/lib/s3_helper.rb b/lib/s3_helper.rb
index 817f00c..636b278 100644
--- a/lib/s3_helper.rb
+++ b/lib/s3_helper.rb
@@ -230,7 +230,7 @@ class S3Helper
   def download_file(filename, destination_path, failure_message = nil)
   rescue => err
-    raise failure_message&.to_s || "Failed to download #{filename} because #{err.message}"
+    raise failure_message&.to_s || "Failed to download #{filename} because #{err.message.length > 0 ? err.message : err.class.to_s}"
   def s3_client

GitHub sha: c25dc43f

This commit appears in #10425 which was approved by eviltrout. It was merged by Supermathie.