mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
storage: return errors instead of panics
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
1e5ea7e09c
commit
4d576a4817
1 changed files with 12 additions and 4 deletions
|
@ -843,12 +843,16 @@ func (is *ImageStoreFS) PutBlobChunkStreamed(repo string, uuid string, body io.R
|
||||||
DefaultFilePerms,
|
DefaultFilePerms,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
is.log.Fatal().Err(err).Msg("failed to open file")
|
is.log.Error().Err(err).Msg("failed to open file")
|
||||||
|
|
||||||
|
return -1, err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
if _, err := file.Seek(0, io.SeekEnd); err != nil {
|
if _, err := file.Seek(0, io.SeekEnd); err != nil {
|
||||||
is.log.Fatal().Err(err).Msg("failed to seek file")
|
is.log.Error().Err(err).Msg("failed to seek file")
|
||||||
|
|
||||||
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := io.Copy(file, body)
|
n, err := io.Copy(file, body)
|
||||||
|
@ -884,12 +888,16 @@ func (is *ImageStoreFS) PutBlobChunk(repo string, uuid string, from int64, to in
|
||||||
DefaultFilePerms,
|
DefaultFilePerms,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
is.log.Fatal().Err(err).Msg("failed to open file")
|
is.log.Error().Err(err).Msg("failed to open file")
|
||||||
|
|
||||||
|
return -1, err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
if _, err := file.Seek(from, io.SeekStart); err != nil {
|
if _, err := file.Seek(from, io.SeekStart); err != nil {
|
||||||
is.log.Fatal().Err(err).Msg("failed to seek file")
|
is.log.Error().Err(err).Msg("failed to seek file")
|
||||||
|
|
||||||
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := io.Copy(file, body)
|
n, err := io.Copy(file, body)
|
||||||
|
|
Loading…
Reference in a new issue