public function handleRpcErrors($error)
    {
        switch ($error['code']) {
            case -32600:
                throw new \InvalidArgumentException('Invalid Request: '. $error['message']);
            case -32601:
                throw new \BadFunctionCallException('Procedure not found: '. $error['message']);
            case -32602:
                throw new \InvalidArgumentException('Invalid arguments: '. $error['message']);
            case -32603:
                throw new \RuntimeException('Internal Error: '. $error['message']);
            default:
                throw new \RuntimeException('Invalid request/response: '. $error['message'], $error['code']);
        }
    }