Module: Indexer::Error

Included in:
ValidationError
Defined in:
lib/indexer/error.rb

Overview

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.

Class Method Summary collapse

Class Method Details

.exception(msg = nil, orig = $!) ⇒ Object

Just catch the error and raise this instead.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/indexer/error.rb', line 9

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