Sha256: 2741d5bb1b9996307e8e297bb57c6ee86afe81064c3881fcaf3c05708f613d31

Contents?: true

Size: 716 Bytes

Versions: 6

Compression:

Stored size: 716 Bytes

Contents

module SlackRubyBot
  module Commands
    class Base
      class << self
        alias _invoke invoke

        def invoke(client, data)
          _invoke client, data
        rescue Mongoid::Errors::Validations => e
          logger.info "#{name.demodulize.upcase}: #{client.owner}, error - #{e.document.class}, #{e.document.errors.to_hash}"
          client.say(channel: data.channel, text: e.document.errors.first[1])
          true
        rescue StandardError => e
          logger.info "#{name.demodulize.upcase}: #{client.owner}, #{e.class}: #{e}"
          logger.debug e.backtrace.join("\n")
          client.say(channel: data.channel, text: e.message)
          true
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-ruby-bot-server-1.2.1 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-1.2.0 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-1.1.0 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-1.0.0 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.12.3 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.12.2 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb