fix: handle both when IsError is true and when we have an error object
This commit is contained in:
parent
d017b0741c
commit
aa2ee9eee2
|
@ -3,6 +3,7 @@ package storage
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
||||||
"git.lumeweb.com/LumeWeb/portal/db/models"
|
"git.lumeweb.com/LumeWeb/portal/db/models"
|
||||||
"git.lumeweb.com/LumeWeb/portal/interfaces"
|
"git.lumeweb.com/LumeWeb/portal/interfaces"
|
||||||
|
@ -58,8 +59,13 @@ func (s StorageServiceImpl) PutFile(file io.ReadSeeker, bucket string, generateP
|
||||||
|
|
||||||
s.portal.Logger().Info("resp", zap.Any("resp", resp.String()))
|
s.portal.Logger().Info("resp", zap.Any("resp", resp.String()))
|
||||||
|
|
||||||
if resp.IsError() && resp.Error() != nil {
|
if resp.IsError() {
|
||||||
return nil, resp.Error().(error)
|
if resp.Error() != nil {
|
||||||
|
return nil, resp.Error().(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, errors.New(resp.String())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash[:], nil
|
return hash[:], nil
|
||||||
|
|
Loading…
Reference in New Issue