ably / ably-java

Java, Android, Clojure and Scala client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
86 stars 39 forks source link

Extract all Ably status codes in constant class #838

Open qsdigor opened 2 years ago

qsdigor commented 2 years ago

There are a lot of places where Ably status codes are hard coded. This is not a good practice as we should use static variables instead. What I suggest is that we create a new class AblyConstants and specify all ably specific status codes used in the app. There are also comments about errors that will be useful for developers.

This is a sample of the current code implementation callback.onError(new ErrorInfo("Unexpected link URL format", 500, 50000));

This is the suggested solution callback.onError(new ErrorInfo("Unexpected link URL format", 500, INTERNAL_ERROR_50000));

┆Issue is synchronized with this Jira Task by Unito

QuintinWillison commented 2 years ago

Static constants, perhaps, or enum probably more suited.