From 5b06de15b46ddeba8efd7645276682388d0f8943 Mon Sep 17 00:00:00 2001 From: extio-de Date: Sun, 10 May 2026 19:25:26 +0200 Subject: [PATCH] fix: Improve error handling in OllamaClient by logging errors and throwing exceptions --- .../de/extio/lmlib/client/ollama/OllamaClient.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/extio/lmlib/client/ollama/OllamaClient.java b/src/main/java/de/extio/lmlib/client/ollama/OllamaClient.java index 1917c9c..cf4ed81 100644 --- a/src/main/java/de/extio/lmlib/client/ollama/OllamaClient.java +++ b/src/main/java/de/extio/lmlib/client/ollama/OllamaClient.java @@ -452,16 +452,16 @@ public class OllamaClient implements Client { .toList(); } catch (final RestClientResponseException e) { - LOGGER.warn("Failed to load Ollama model names: {} {}", e.getStatusCode(), e.getStatusText()); - return List.of(); + LOGGER.error("Failed to load Ollama model names: {} {}", e.getStatusCode(), e.getStatusText()); + throw new IllegalStateException("Failed to load Ollama model names: " + e.getStatusCode() + " " + e.getStatusText(), e); } catch (final RestClientException e) { - LOGGER.warn("Failed to load Ollama model names: {}", e.getMessage()); - return List.of(); + LOGGER.error("Failed to load Ollama model names: {}", e.getMessage()); + throw new IllegalStateException("Failed to load Ollama model names: " + e.getMessage(), e); } catch (final RuntimeException e) { - LOGGER.warn("Failed to load Ollama model names", e); - return List.of(); + LOGGER.error("Failed to load Ollama model names", e); + throw new IllegalStateException("Failed to load Ollama model names: " + e.getMessage(), e); } }