Class: ZK::Group::GroupExceptionTranslator
- Inherits:
-
Object
- Object
- ZK::Group::GroupExceptionTranslator
- Defined in:
- lib/zk-group.rb
Overview
A simple proxy for catching client errors and re-raising them as Group specific errors (for clearer error reporting…we hope)
Instance Method Summary collapse
-
#initialize(zk, group) ⇒ GroupExceptionTranslator
constructor
A new instance of GroupExceptionTranslator.
Constructor Details
#initialize(zk, group) ⇒ GroupExceptionTranslator
Returns a new instance of GroupExceptionTranslator.
38 39 40 41 |
# File 'lib/zk-group.rb', line 38 def initialize(zk, group) @zk = zk @group = group end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object (private)
44 45 46 47 48 49 50 51 |
# File 'lib/zk-group.rb', line 44 def method_missing(m, *a, &b) super unless @zk.respond_to?(m) @zk.__send__(m, *a, &b) rescue Exceptions::NoNode raise Exceptions::GroupDoesNotExistError, "group at #{@group.path} has not been created yet", caller rescue Exceptions::NodeExists raise Exceptions::GroupAlreadyExistsError, "group at #{@group.path} already exists", caller end |