-
Notifications
You must be signed in to change notification settings - Fork 44
Standardise on when exceptions are thrown and when callbacks are used #266
Description
The publish method can raise an AblyException, but also has a completionListener which handles success & failure conditions.
Now if you look at https://goo.gl/Hc0yqK, you can see that if a channel is in invalid state we raise an exception, yet if RTL6c3 was implemented correctly it should fail it the channel becomes FAILED / SUSPENDED before the message is published.
IMHO this is wrong and confusing for developers. See ably/ably-ruby@92686ae where I have changed this in Ruby, and https://github.com/ably/wiki/issues/175 (points 6 & 7).
I believe our policy for async methods / methods with callbacks should be that if the arguments provided are invalid then raise an exception, otherwise any exceptions relating to the state of the library or future state of the library should be passed as a failure argument in the callback