Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
29fe07f0
Unverified
Commit
29fe07f0
authored
Jul 24, 2023
by
Bruce MacDonald
Committed by
GitHub
Jul 24, 2023
Browse files
make response errors unique for error trace
parents
4cb42ca5
abfc73d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
server/images.go
server/images.go
+7
-7
No files found.
server/images.go
View file @
29fe07f0
...
...
@@ -510,7 +510,7 @@ func CopyModel(src, dest string) error {
return
err
}
err
=
ioutil
.
WriteFile
(
destPath
,
input
,
0644
)
err
=
ioutil
.
WriteFile
(
destPath
,
input
,
0
o
644
)
if
err
!=
nil
{
fmt
.
Println
(
"Error reading file:"
,
err
)
return
err
...
...
@@ -669,7 +669,7 @@ func PushModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on push
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
fn
(
api
.
ProgressResponse
{
Status
:
"success"
})
...
...
@@ -743,7 +743,7 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if
resp
.
StatusCode
!=
http
.
StatusOK
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
nil
,
fmt
.
Errorf
(
"registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
return
nil
,
fmt
.
Errorf
(
"
on pull
registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
}
var
m
*
ManifestV2
...
...
@@ -807,7 +807,7 @@ func startUpload(mp ModelPath, regOpts *RegistryOptions) (string, error) {
// Check for success
if
resp
.
StatusCode
!=
http
.
StatusAccepted
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
""
,
fmt
.
Errorf
(
"registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
return
""
,
fmt
.
Errorf
(
"
on upload
registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
}
// Extract UUID location from header
...
...
@@ -896,7 +896,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
Completed
:
int
(
totalUploaded
),
})
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on layer upload
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
totalUploaded
+=
n
...
...
@@ -913,7 +913,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on finish upload
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
break
}
...
...
@@ -964,7 +964,7 @@ func downloadBlob(mp ModelPath, digest string, regOpts *RegistryOptions, fn func
if
resp
.
StatusCode
!=
http
.
StatusOK
&&
resp
.
StatusCode
!=
http
.
StatusPartialContent
{
body
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on download
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
err
=
os
.
MkdirAll
(
path
.
Dir
(
fp
),
0
o700
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment