Exception: Bluepine::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bluepine/error.rb

Overview

Examples:

InvaldKey = Error.create("Invalid %s key")
raise InvalidKey, "id"

Constant Summary collapse

MESSAGE =
"Error"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Error

Returns a new instance of Error.



13
14
15
# File 'lib/bluepine/error.rb', line 13

def initialize(*args)
  super args.any? ? MESSAGE % args : MESSAGE
end

Class Method Details

.create(msg) ⇒ Object



6
7
8
9
10
# File 'lib/bluepine/error.rb', line 6

def self.create(msg)
  Class.new(Error) do
    MESSAGE.replace msg
  end
end