Sha256: 1c3b995a7a36911617c9fed11ac8fd3a0416d0e3d6846c070d9ece9ec771eb13

Contents?: true

Size: 532 Bytes

Versions: 4

Compression:

Stored size: 532 Bytes

Contents

module Indexer

  # Tag module for Metaspec Exceptions.
  #
  # Use this module to extend arbitrary errors raised by Metaspec,
  # so they can be easily identified as Metaspec errors if need be. 
  module Error
    # Just catch the error and raise this instead.
    def self.exception(msg=nil,orig=$!)
      if Class === orig
        orig = orig.new(msg)
      elsif orig.nil?
        orig = StandardError.new(msg)
      else
        orig = orig.exception(msg) if msg
      end
      orig.extend self
      orig
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
indexer-0.3.1 lib/indexer/error.rb
indexer-0.3.0 lib/indexer/error.rb
indexer-0.2.0 lib/indexer/error.rb
indexer-0.1.0 lib/indexer/error.rb