Commit 37ebb839 authored by legoc's avatar legoc
Browse files

Process error in SessionManager.login()

parent 67924e18
......@@ -50,6 +50,9 @@ public class SessionManager {
public class ClientAlreadyLaunchedException extends Exception {};
public class MultipleConnectionsPerUserNotAllowedException extends Exception {};
public class MultipleClientsPerEndpointNotAllowedException extends Exception {};
/*
* Constructor. Use private constructor to enforce singleton pattern.
......@@ -134,8 +137,11 @@ public class SessionManager {
try {
Common.Int32Response response = Common.Int32Response.parseFrom(sessionRequester.receive());
// TODO: refine the behaviour depending on the error: MULTIPLE_CONNECTIONS_PER_USER_NOT_ALLOWED, MULTIPLE_CLIENTS_PER_ENDPOINT_NOT_ALLOWED.
if (response.hasError()) {
// Process the error.
if (response.getError() == Common.Error.Type.MULTIPLE_CONNECTIONS_PER_USER_NOT_ALLOWED) {
throw new ClientAlreadyLaunchedException();
}
else if (response.getError() == Common.Error.Type.MULTIPLE_CLIENTS_PER_ENDPOINT_NOT_ALLOWED) {
throw new ClientAlreadyLaunchedException();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment