Refactor AddressBook methods to streamline peer address handling and improve error management
https://github.com/nosial/Socialbox-PHP/issues/29
This commit is contained in:
parent
81b3dcf3ea
commit
a842818175
7 changed files with 23 additions and 58 deletions
|
@ -29,19 +29,12 @@
|
|||
throw new MissingRpcArgumentException('peer');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$address = PeerAddress::fromAddress($rpcRequest->getParameter('peer'));
|
||||
}
|
||||
catch(InvalidArgumentException $e)
|
||||
{
|
||||
throw new InvalidRpcArgumentException('peer', $e);
|
||||
}
|
||||
$peerAddress = PeerAddress::fromAddress($rpcRequest->getParameter('peer'));
|
||||
|
||||
try
|
||||
{
|
||||
$peer = $request->getPeer();
|
||||
return $rpcRequest->produceResponse(ContactManager::isContact($peer, $address));
|
||||
return $rpcRequest->produceResponse(ContactManager::isContact($peer, $peerAddress));
|
||||
}
|
||||
catch (DatabaseOperationException $e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue