Module: DBStruct::ErrorHelpers

Included in:
DBStruct, DBStruct
Defined in:
lib/internal/error.rb

Overview

Error checking needs to be global, so we put it in a module and import it everywhere.

Instance Method Summary collapse

Instance Method Details

#check(message, exception = Failure, &block) ⇒ Object

Error check: if block evaluates to false, raise a Lite3::DBM::Error with the given message.

Raises:

  • (exception)


27
28
29
30
# File 'lib/internal/error.rb', line 27

def check(message, exception = Failure, &block)
  return if block && block.call
  raise exception.new(message)
end

#oops(msg) ⇒ Object

Raises:



32
# File 'lib/internal/error.rb', line 32

def oops(msg) raise Failure.new(msg) ; end