Sha256: 0e92011ab54b580ebd6b4fbb46c4d4152fe44033703bbded949d4db1e44c8609

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Command

    class Fault < StandardError

      attr_reader :caused_by, :thrown_by, :reason

      def initialize(caused_by, thrown_by, reason)
        super(reason)

        @caused_by = caused_by
        @thrown_by = thrown_by
        @reason = reason
      end

      def fault_klass
        @fault_klass ||= self.class.name.split("::").last
      end

      def fault_name
        @fault_name ||= fault_klass.downcase
      end

    end

    class Noop < Fault; end
    class Invalid < Fault; end
    class Failure < Fault; end
    class Error < Fault; end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lite-command-2.0.2 lib/lite/command/fault.rb