fix: Improve error handling in OllamaClient by logging errors and throwing exceptions
This commit is contained in:
@@ -452,16 +452,16 @@ public class OllamaClient implements Client {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
catch (final RestClientResponseException e) {
|
catch (final RestClientResponseException e) {
|
||||||
LOGGER.warn("Failed to load Ollama model names: {} {}", e.getStatusCode(), e.getStatusText());
|
LOGGER.error("Failed to load Ollama model names: {} {}", e.getStatusCode(), e.getStatusText());
|
||||||
return List.of();
|
throw new IllegalStateException("Failed to load Ollama model names: " + e.getStatusCode() + " " + e.getStatusText(), e);
|
||||||
}
|
}
|
||||||
catch (final RestClientException e) {
|
catch (final RestClientException e) {
|
||||||
LOGGER.warn("Failed to load Ollama model names: {}", e.getMessage());
|
LOGGER.error("Failed to load Ollama model names: {}", e.getMessage());
|
||||||
return List.of();
|
throw new IllegalStateException("Failed to load Ollama model names: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
catch (final RuntimeException e) {
|
catch (final RuntimeException e) {
|
||||||
LOGGER.warn("Failed to load Ollama model names", e);
|
LOGGER.error("Failed to load Ollama model names", e);
|
||||||
return List.of();
|
throw new IllegalStateException("Failed to load Ollama model names: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user