ably-java icon indicating copy to clipboard operation
ably-java copied to clipboard

Extract all HTTP status codes in HttpConstants

Open qsdigor opened this issue 2 years ago • 1 comments

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)

┆Issue is synchronized with this Jira Task by Unito

qsdigor avatar Sep 16 '22 07:09 qsdigor

Static constants, perhaps, or enum probably more suited.

QuintinWillison avatar Sep 16 '22 07:09 QuintinWillison