mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:38:17 +08:00
report errors from the populate.thor tool
This commit is contained in:
parent
93dfc87b99
commit
3b9a1410f8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user