mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 15:57:04 +00:00
cli: catch upstream errors gracefully (#11512)
This commit is contained in:
@@ -1137,6 +1137,14 @@ func chat(cmd *cobra.Command, opts runOptions) (*api.Message, error) {
|
|||||||
if errors.Is(err, context.Canceled) {
|
if errors.Is(err, context.Canceled) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this error should ideally be wrapped properly by the client
|
||||||
|
if strings.Contains(err.Error(), "upstream error") {
|
||||||
|
p.StopAndClear()
|
||||||
|
fmt.Println("An error occurred while processing your message. Please try again.")
|
||||||
|
fmt.Println()
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user