diff options
Diffstat (limited to 'app/lib/command_tag/processor.rb')
-rw-r--r-- | app/lib/command_tag/processor.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/lib/command_tag/processor.rb b/app/lib/command_tag/processor.rb index 2c33b5f83..9edcb58ba 100644 --- a/app/lib/command_tag/processor.rb +++ b/app/lib/command_tag/processor.rb @@ -12,6 +12,12 @@ require_relative 'commands' +class CommandTag::Break < Mastodon::Error + def initialize(msg = 'A handler stopped execution.') + super + end +end + class CommandTag::Processor include Redisable include ImgProxyHelper @@ -83,6 +89,8 @@ class CommandTag::Processor execute_statements(:at_end) all_handlers!(:shutdown) + rescue CommandTag::Break + nil rescue StandardError => e @status.update(published: false) @status.destroy @@ -247,6 +255,13 @@ class CommandTag::Processor @status.destroy end + def replace_status!(new_status) + return if new_status.blank? + + destroy_status! + @status = new_status + end + def normalize(text) text.to_s.strip.downcase end |