containsParameter('peer')) { throw new MissingRpcArgumentException('peer'); } try { $address = PeerAddress::fromAddress($rpcRequest->getParameter('peer')); } catch(InvalidArgumentException $e) { throw new InvalidRpcArgumentException('peer', $e->getMessage()); } try { if(!ContactManager::isContact($request->getPeer(), $address)) { return $rpcRequest->produceError(StandardError::NOT_FOUND, 'Contact does not exist'); } $contact = ContactManager::getContact($request->getPeer(), $address); } catch(DatabaseOperationException $e) { throw new StandardRpcException('Failed to get contact', StandardError::INTERNAL_SERVER_ERROR, $e); } return $rpcRequest->produceResponse($contact->toStandard()); } }