win: detect background upgrade in progress (#10785)

Give the user a helpful error instead of showing
connection refused errors.
This commit is contained in:
Daniel Hiltgen
2025-05-21 10:46:56 -07:00
committed by GitHub
parent c890011322
commit 7359b02707
2 changed files with 51 additions and 3 deletions

View File

@@ -1236,11 +1236,11 @@ func checkServerHeartbeat(cmd *cobra.Command, _ []string) error {
return err
}
if err := client.Heartbeat(cmd.Context()); err != nil {
if !strings.Contains(err.Error(), " refused") {
if !(strings.Contains(err.Error(), " refused") || strings.Contains(err.Error(), "could not connect")) {
return err
}
if err := startApp(cmd.Context(), client); err != nil {
return errors.New("could not connect to ollama app, is it running?")
return fmt.Errorf("ollama server not responding - %w", err)
}
}
return nil