rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
241 stars 85 forks source link

RMQTransport#write should return something sensible #10

Closed camelpunch closed 8 years ago

camelpunch commented 8 years ago

At present we return an NSString *. We should return some other nullable object so the 'throws' interface is still generated for Swift. A string is just a hack.

michaelklishin commented 8 years ago

Returning self assumes that whenever there is a failure (e.g. EWOULDBLOCK), an exception would be thrown. Is that the case?

camelpunch commented 8 years ago

https://github.com/robbiehanson/CocoaAsyncSocket is handling socket errors, and we'd receive a callback when one occurred. We have to return some sort of nullable object from write, so that the throws Swift interop interface is generated. Swift uses a nil return to detect the presence of an error. We're doing that here: https://github.com/camelpunch/RMQClient/blob/master/RMQClient/RMQTCPSocketTransport.m#L62