Improved Peer Resolution and fixed minor bugs and issues, completed todo

This commit is contained in:
netkas 2025-01-31 15:31:07 -05:00
parent 7a39b0fd35
commit 8c2cbf48d5
5 changed files with 209 additions and 155 deletions

View file

@ -6,6 +6,7 @@
use Socialbox\Classes\Configuration;
use Socialbox\Classes\Utilities;
use Socialbox\Enums\StandardError;
use Socialbox\Exceptions\RpcException;
use Socialbox\Objects\RpcError;
use Socialbox\Objects\RpcRequest;
use Throwable;
@ -38,4 +39,9 @@
return $request->produceError(StandardError::from($this->code), $this->message);
}
public static function fromRpcException(RpcException $e): StandardRpcException
{
return new self($e->getMessage(), StandardError::tryFrom($e->getCode()) ?? StandardError::UNKNOWN, $e);
}
}