Class: ZK::Group::MemberExceptionTranslator

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(zk) ⇒ MemberExceptionTranslator

Returns a new instance of MemberExceptionTranslator.



59
60
61
# File 'lib/zk-group.rb', line 59

def initialize(zk)
  @zk = zk
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object (private)



64
65
66
67
68
69
70
71
# File 'lib/zk-group.rb', line 64

def method_missing(m, *a, &b)
  super unless @zk.respond_to?(m)
  @zk.__send__(m, *a, &b)
rescue Exceptions::NoNode
  raise Exceptions::MemberDoesNotExistError, "group at #{path} has not been created yet", caller
rescue Exceptions::NodeExists
  raise Exceptions::MemberAlreadyExistsError, "group at #{path} already exists", caller
end