Permalink
Browse files

Improved invalidation error reporting

  • Loading branch information...
1 parent 2364cd1 commit 35497a0c52ef06200bcb01bb6e83615e301ccecc Kliment Mamykin committed Apr 17, 2011
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/jammit/s3_uploader.rb
View
@@ -139,7 +139,23 @@ def invalidate_cache(files)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = http.request(req)
- log res.code == "201" ? 'Invalidation request succeeded' : "Failed #{res.code}. Body: #{res.body}"
+ log result_message(req, res)
+ end
+
+ def result_message req, res
+ if res.code == "201"
+ 'Invalidation request succeeded'
+ else
+ <<-EOM.gsub(/^\s*/, '')
+ =============================
+ Failed with #{res.code} error!
+ Request path:#{req.path}
+ Request header: #{req.to_hash}
+ Request body:#{req.body}
+ Response body: #{res.body}
+ =============================
+ EOM
+ end
end
def log(msg)

0 comments on commit 35497a0

Please sign in to comment.