@@ -12,6 +12,7 @@ import (
1212 "strings"
1313
1414 "github.com/docker/model-distribution/distribution"
15+ "github.com/docker/model-distribution/registry"
1516 "github.com/docker/model-distribution/types"
1617 "github.com/docker/model-runner/pkg/inference"
1718 "github.com/docker/model-runner/pkg/logging"
@@ -129,17 +130,17 @@ func (m *Manager) handleCreateModel(w http.ResponseWriter, r *http.Request) {
129130 // Pull the model. In the future, we may support additional operations here
130131 // besides pulling (such as model building).
131132 if err := m .PullModel (r .Context (), request .From , w ); err != nil {
132- if errors .Is (err , distribution .ErrInvalidReference ) {
133+ if errors .Is (err , registry .ErrInvalidReference ) {
133134 m .log .Warnf ("Invalid model reference %q: %v" , request .From , err )
134135 http .Error (w , "Invalid model reference" , http .StatusBadRequest )
135136 return
136137 }
137- if errors .Is (err , distribution .ErrUnauthorized ) {
138+ if errors .Is (err , registry .ErrUnauthorized ) {
138139 m .log .Warnf ("Unauthorized to pull model %q: %v" , request .From , err )
139140 http .Error (w , "Unauthorized" , http .StatusUnauthorized )
140141 return
141142 }
142- if errors .Is (err , distribution .ErrModelNotFound ) {
143+ if errors .Is (err , registry .ErrModelNotFound ) {
143144 m .log .Warnf ("Failed to pull model %q: %v" , request .From , err )
144145 http .Error (w , "Model not found" , http .StatusNotFound )
145146 return
@@ -388,7 +389,7 @@ func (m *Manager) handlePushModel(w http.ResponseWriter, r *http.Request, model
388389 http .Error (w , "Model not found" , http .StatusNotFound )
389390 return
390391 }
391- if errors .Is (err , distribution .ErrUnauthorized ) {
392+ if errors .Is (err , registry .ErrUnauthorized ) {
392393 m .log .Warnf ("Unauthorized to push model %q: %v" , model , err )
393394 http .Error (w , "Unauthorized" , http .StatusUnauthorized )
394395 return
0 commit comments