-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
difficulty: 🙃🙃🙃Above average taskAbove average taskscope: 🛠️it's job for developersit's job for developerstype: refactorno change in functionality, but in mechanizm under the hood, improving performance or securityno change in functionality, but in mechanizm under the hood, improving performance or security
Description
It would be more readable and safer if we would use ReactionManager to get the classes related to the type of the client request. Or create entirely new class like ReactionRepository, and convert class ReactionManager to some ReactionLoader so the concern of loading and storing are separated.
By throwing exception instead of returning null, this exception can be caught in the onError method, thus making onMessage more readable.
Lines 112 to 124 in da9b9de
| // Get the type of the message | |
| String type = receivedMessage.getType(); | |
| // Find appropriate reaction to the message type received | |
| // TODO: It could be more readable if we use some ReactionRepository with get method that would throws exception instead of null | |
| Class<? extends Reaction> reactionClass = reactions.get(type); | |
| if (reactionClass == null) { | |
| Log.TRACE("Unknown reaction type: " + type); | |
| ErrorResponse response = new ErrorResponse(Result.FAILURE, "This message type has not been found!"); | |
| webSocket.send(response.ToJson()); | |
| return; | |
| } |
Metadata
Metadata
Assignees
Labels
difficulty: 🙃🙃🙃Above average taskAbove average taskscope: 🛠️it's job for developersit's job for developerstype: refactorno change in functionality, but in mechanizm under the hood, improving performance or securityno change in functionality, but in mechanizm under the hood, improving performance or security