Sha256: c05036e8a783c4cbe04429384c3c236161b4a2018b2c60a9dbdf846475d137e8

Contents?: true

Size: 1.96 KB

Versions: 16

Compression:

Stored size: 1.96 KB

Contents

module Xampl

  class XamplIsInvalid < Exception
    attr_reader :msg, :xampl

    def initialize(xampl)
      @xampl = xampl
      @msg = "Invalid Xampl:: #{xampl}"
    end

    def message
      @msg
    end
  end

  class AlreadyKnownToPersister < Exception
    attr_reader :msg, :xampl

    def initialize(xampl, persister)
      @xampl = xampl
      @msg = "#{xampl} #{xampl.get_the_index} is already known by a persister: #{xampl.persister.name}, so cannot use persister #{persister.name}"
    end

    def message
      @msg
    end
  end

  class XamplException < Exception
    attr_reader :name, :msg

    def initialize(name, message=nil)
      @name = name
      @msg = message ? message : ""
    end

    def message
      "XamplException #{@name} #{@msg}"
    end
  end

  class NoActivePersister < Exception
    def message
      "No Persister is active"
    end
  end

  class BlockedChange < Exception
    attr_reader :xampl

    def initialize(xampl=nil)
      @xampl = xampl
    end

    def message
      "attempt to change #{@xampl}, pid: #{@xampl.get_the_index}, oid: #{@xampl.object_id} when changes are blocked"
    end
  end

  class UnmanagedChange < Exception
    attr_reader :xampl

    def initialize(xampl=nil)
      @xampl = xampl
    end

    def message
      "attempt to change #{@xampl}, pid: #{@xampl.get_the_index}, oid: #{@xampl.object_id} outside of its persister's management"
    end
  end

  class IncompatiblePersisterRequest < Exception
    attr_reader :msg

    def initialize(persister, feature_name, requested_feature_value, actual_feature_value)
      @msg = "persister #{persister.name}:: requested feature: #{feature_name} #{requested_feature_value}, actual: #{actual_feature_value}"
    end

    def message
      @msg
    end
  end

  class MixedPersisters < Exception
    attr_reader :msg

    def initialize(active, local)
      @msg = "mixed persisters:: active #{active.name}, local: #{local.name}"
    end

    def message
      @msg
    end
  end

end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
hutch-xamplr-1.1.0 lib/xamplr/exceptions.rb
hutch-xamplr-1.1.1 lib/xamplr/exceptions.rb
hutch-xamplr-1.1.2 lib/xamplr/exceptions.rb
hutch-xamplr-1.1.4 lib/xamplr/exceptions.rb
hutch-xamplr-1.2.0 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.0 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.1 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.10 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.11 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.12 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.13 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.14 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.3 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.8 lib/xamplr/exceptions.rb
hutch-xamplr-1.3.9 lib/xamplr/exceptions.rb
xamplr-1.2.0 lib/xamplr/exceptions.rb