Unverified Commit af9039a1 authored by Bruce MacDonald's avatar Bruce MacDonald Committed by GitHub
Browse files

better error message when model not found on pull

parents 0deb3767 07ed69bc
...@@ -131,7 +131,7 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f ...@@ -131,7 +131,7 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f
} }
if errorResponse.Error != "" { if errorResponse.Error != "" {
return fmt.Errorf("stream: %s", errorResponse.Error) return fmt.Errorf(errorResponse.Error)
} }
if response.StatusCode >= 400 { if response.StatusCode >= 400 {
......
...@@ -684,7 +684,7 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon ...@@ -684,7 +684,7 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
manifest, err := pullModelManifest(mp, regOpts) manifest, err := pullModelManifest(mp, regOpts)
if err != nil { if err != nil {
return fmt.Errorf("pull model manifest: %q", err) return fmt.Errorf("pull model manifest: %s", err)
} }
var layers []*Layer var layers []*Layer
...@@ -753,6 +753,9 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err ...@@ -753,6 +753,9 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created // Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
if resp.StatusCode == http.StatusNotFound {
return nil, fmt.Errorf("model not found")
}
body, _ := io.ReadAll(resp.Body) body, _ := io.ReadAll(resp.Body)
return nil, fmt.Errorf("on pull registry responded with code %d: %s", resp.StatusCode, body) return nil, fmt.Errorf("on pull registry responded with code %d: %s", resp.StatusCode, body)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment