Sha256: 1dd616bacf603dbd88958c7e7be5552df8f169801aab98bed8322ade8260a314

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

require 'honeybadger/plugin'
require 'honeybadger/ruby'

module Honeybadger
  module Plugins
    module Thor
      def self.included(base)
        base.class_eval do
          no_commands do
            alias_method :invoke_command_without_honeybadger, :invoke_command
            alias_method :invoke_command, :invoke_command_with_honeybadger
          end
        end
      end

      def invoke_command_with_honeybadger(*args)
        invoke_command_without_honeybadger(*args)
      rescue Exception => e
        Honeybadger.notify(e)
        raise
      end
    end

    Plugin.register do
      requirement { defined?(::Thor.no_commands) }

      execution do
        return unless Honeybadger.config[:'exceptions.enabled']
        ::Thor.send(:include, Thor)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
honeybadger-5.24.0 lib/honeybadger/plugins/thor.rb