containsParameter('public_key')) { return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Missing parameter \'public_key\''); } try { $uuid = SessionManager::createSession($rpcRequest->getParameter('public_key')); } catch(DatabaseOperationException $e) { return $rpcRequest->produceError(StandardError::INTERNAL_SERVER_ERROR, 'There was an error while trying to create a new session: ' . $e->getMessage()); } catch(InvalidArgumentException $e) { return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, $e->getMessage()); } return $rpcRequest->produceResponse($uuid); } }