From 3b9a1410f8e55d5b48498a3c3408c0c98334c7cc Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 17 Oct 2016 14:01:37 -0400 Subject: [PATCH] report errors from the populate.thor tool --- lib/tasks/populate.thor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tasks/populate.thor b/lib/tasks/populate.thor index e19323d177e..531f0efa229 100644 --- a/lib/tasks/populate.thor +++ b/lib/tasks/populate.thor @@ -74,6 +74,10 @@ class Populate < Thor puts "Making a new topic: '#{topic_title}'" post_creator = PostCreator.new(users.sample, title: topic_title, raw: generate_sentence(7)) first_post = post_creator.create + unless first_post + puts post_creator.errors.full_messages, "" + raise StandardError.new(post_creator.errors.full_messages) + end topic = first_post.topic start_post = 2 topic @@ -83,7 +87,11 @@ class Populate < Thor print '.' raw = rand(4) == 0 ? (rand(2) == 0 ? image_posts.sample : wikipedia_posts.sample) : generate_sentence(7) post_creator = PostCreator.new(users.sample, topic_id: topic.id, raw: raw) - post_creator.create + post = post_creator.create + unless post + puts post_creator.errors.full_messages, "" + end + post end def hipster_words