From aa2ee9eee22487f35c8ec9acd34709c7d36cadc7 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 16 Jan 2024 01:36:19 -0500 Subject: [PATCH] fix: handle both when IsError is true and when we have an error object --- storage/storage.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index d38a357..d620f31 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -3,6 +3,7 @@ package storage import ( "bytes" "encoding/hex" + "errors" "git.lumeweb.com/LumeWeb/libs5-go/encoding" "git.lumeweb.com/LumeWeb/portal/db/models" "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())) - if resp.IsError() && resp.Error() != nil { - return nil, resp.Error().(error) + if resp.IsError() { + if resp.Error() != nil { + return nil, resp.Error().(error) + } + + return nil, errors.New(resp.String()) + } return hash[:], nil