From 3cd9404cc04200ff076b5c946ce8570aaeab5297 Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Fri, 14 Jun 2024 11:47:48 +0300 Subject: [PATCH] rpc : throw an exception when the RPC endpoint is unreachable Returning nullptr in this case leads to obscure crashes, better fail fast --- ggml-rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml-rpc.cpp b/ggml-rpc.cpp index 22d9524b8..cbef90af5 100644 --- a/ggml-rpc.cpp +++ b/ggml-rpc.cpp @@ -671,7 +671,7 @@ GGML_API GGML_CALL ggml_backend_buffer_type_t ggml_backend_rpc_buffer_type(const } auto sock = get_socket(endpoint); if (sock == nullptr) { - return nullptr; + throw std::runtime_error("Failed to connect to " + std::string(endpoint)); } size_t alignment = get_alignment(sock); size_t max_size = get_max_size(sock);