mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
report errors from the populate.thor tool
This commit is contained in:
@ -74,6 +74,10 @@ class Populate < Thor
|
|||||||
puts "Making a new topic: '#{topic_title}'"
|
puts "Making a new topic: '#{topic_title}'"
|
||||||
post_creator = PostCreator.new(users.sample, title: topic_title, raw: generate_sentence(7))
|
post_creator = PostCreator.new(users.sample, title: topic_title, raw: generate_sentence(7))
|
||||||
first_post = post_creator.create
|
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
|
topic = first_post.topic
|
||||||
start_post = 2
|
start_post = 2
|
||||||
topic
|
topic
|
||||||
@ -83,7 +87,11 @@ class Populate < Thor
|
|||||||
print '.'
|
print '.'
|
||||||
raw = rand(4) == 0 ? (rand(2) == 0 ? image_posts.sample : wikipedia_posts.sample) : generate_sentence(7)
|
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 = 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
|
end
|
||||||
|
|
||||||
def hipster_words
|
def hipster_words
|
||||||
|
Reference in New Issue
Block a user