{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/6cbe04be3caf1c81b73a72f9e6b692ff?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6cbe04be3caf1c81b73a72f9e6b692ff","url":"https://api.github.com/users/schmurfy","login":"schmurfy","id":2983},"milestone":null,"labels":[],"assignee":null,"updated_at":"2011-10-31T15:10:32Z","comments":4,"closed_at":null,"url":"https://api.github.com/repos/chuckremes/ffi-rzmq/issues/45","body":"Hi,\r\nWhy did you change the signature of the call in latest version instead of raising an error ?\r\nIf you wanted to make your api looks like C I think you succeeded but that's not really the ruby way...\r\n\r\nThe current code:\r\n\r\n```ruby\r\narray = []\r\nrc = socket.getsockopt(ZMQ::HWM, array)\r\nhwm = array.first if ZMQ::Util.resultcode_ok?(rc)\r\n```\r\n\r\nAnd what it could be:\r\n\r\n```ruby\r\nbegin\r\n  hwm = socket.getsockopt(ZMQ::HWM)\r\nrescue ZMQ::OperationFailed => err\r\n  # do something\r\nend\r\n```\r\n\r\nSince looking at the first really makes me sick I can even provide the pull request, but would you accept it ?\r\n","html_url":"https://github.com/chuckremes/ffi-rzmq/issues/45","title":"new getsockopt signature","number":45,"id":2096048,"created_at":"2011-10-31T11:42:05Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/76f606af44d16f87957d45cd0b0fd484?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"76f606af44d16f87957d45cd0b0fd484","url":"https://api.github.com/users/chuckremes","login":"chuckremes","id":43569},"updated_at":"2011-10-31T15:10:32Z","url":"https://api.github.com/repos/chuckremes/ffi-rzmq/issues/comments/2578045","body":"Yes, please. For example:\n\nmodule ZMQWithExceptions\n  class Context < ZMQ::Context\n\n    def socket type\n      # calling #new on the original code still throws an exception\n      ZMQ::Socket.new @context, type\n    end\n  end\n\n  class Socket < ZMQ::Socket\n    def getsockopt option_name\n      array = []\n      rc = super(option_name, array)\n      if ZMQ::Util.resultcode_ok?(rc)\n        array[0]\n      else\n         raise SocketError.new\n      end\n    end\n  end\nend\n\nOn Oct 31, 2011, at 10:01 AM, Julien Ammous wrote:\n\n> Thanks for the clarifications,\n> I already wrapped it for my personnal needs I just need to find a clean way to add it in the library now.  \n> Do you have a preference on this ? Should I add a new module providing the wrapper classes ?\n> \n> -- \n> Reply to this email directly or view it on GitHub:\n> https://github.com/chuckremes/ffi-rzmq/issues/45#issuecomment-2577901","id":2578045,"created_at":"2011-10-31T15:10:32Z"}}