ably-java
ably-java copied to clipboard
Extract all HTTP status codes in HttpConstants
There are a lot of places where HTTP status codes are hard coded. This is not a good practice as we should use static variables instead. We already have HttpConstants class that contains ContentTypes, Headers, and Methods. What I suggest is that we create a new class inside HttpConstants and specify all error codes used in the app.
This is a sample of the current code implementation
if(errorInfo.statusCode == 403)
This is the suggested solution
if(errorInfo.statusCode == HTTP_FORBIDEN_403)
Static constants, perhaps, or enum
probably more suited.