forked from fedi/mastodon
Extract helper method for error report in cli/accounts command (#25119)
This commit is contained in:
parent
2cecb2dc9e
commit
b7b96efd17
|
@ -113,12 +113,7 @@ module Mastodon::CLI
|
||||||
say('OK', :green)
|
say('OK', :green)
|
||||||
say("New password: #{password}")
|
say("New password: #{password}")
|
||||||
else
|
else
|
||||||
user.errors.each do |error|
|
report_errors(user.errors)
|
||||||
say('Failure/Error: ', :red)
|
|
||||||
say(error.attribute)
|
|
||||||
say(" #{error.type}", :red)
|
|
||||||
end
|
|
||||||
|
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -189,12 +184,7 @@ module Mastodon::CLI
|
||||||
say('OK', :green)
|
say('OK', :green)
|
||||||
say("New password: #{password}") if options[:reset_password]
|
say("New password: #{password}") if options[:reset_password]
|
||||||
else
|
else
|
||||||
user.errors.each do |error|
|
report_errors(user.errors)
|
||||||
say('Failure/Error: ', :red)
|
|
||||||
say(error.attribute)
|
|
||||||
say(" #{error.type}", :red)
|
|
||||||
end
|
|
||||||
|
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -661,6 +651,14 @@ module Mastodon::CLI
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def report_errors(errors)
|
||||||
|
errors.each do |error|
|
||||||
|
say('Failure/Error: ', :red)
|
||||||
|
say(error.attribute)
|
||||||
|
say(" #{error.type}", :red)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rotate_keys_for_account(account, delay = 0)
|
def rotate_keys_for_account(account, delay = 0)
|
||||||
if account.nil?
|
if account.nil?
|
||||||
say('No such account', :red)
|
say('No such account', :red)
|
||||||
|
|
Loading…
Reference in a new issue