From 68572b8afc90c16a0b807eabcb262b25f1190a0c Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 10 Sep 2018 16:02:13 +0800 Subject: [PATCH] Print error messages on why upload fails to save. --- lib/tasks/uploads.rake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake index 19473582c6f..b13b9f16b0c 100644 --- a/lib/tasks/uploads.rake +++ b/lib/tasks/uploads.rake @@ -787,7 +787,11 @@ def recover_from_s3_by_sha1(post:, sha1:, object_keys: []) File.basename(key) ).create_for(post.user_id) - post.rebake! if upload.persisted? + if upload.persisted? + post.rebake! + else + puts "#{post.full_url}\n#{upload.errors.full_messages.join("\n")}" + end end ensure tmp&.close