diff --git a/core/osem_api.go b/core/osem_api.go index 7b18d08..82bc910 100644 --- a/core/osem_api.go +++ b/core/osem_api.go @@ -26,7 +26,10 @@ func NewOsemClient(endpoint string) *OsemClient { func (client *OsemClient) GetBox(boxId string) (*Box, error) { box := &Box{} fail := &OsemError{} - client.sling.New().Path("boxes/").Path(boxId).Receive(box, fail) + _, err := client.sling.New().Path("boxes/").Path(boxId).Receive(box, fail) + if err != nil { + return nil, err + } if fail.Message != "" { return box, errors.New("could not fetch box: " + fail.Message) } @@ -36,7 +39,10 @@ func (client *OsemClient) GetBox(boxId string) (*Box, error) { func (client *OsemClient) GetAllBoxes() (*[]Box, error) { boxes := &[]Box{} fail := &OsemError{} - client.sling.New().Path("boxes").Receive(boxes, fail) + _, err := client.sling.New().Path("boxes").Receive(boxes, fail) + if err != nil { + return nil, err + } if fail.Message != "" { return boxes, errors.New("could not fetch boxes: " + fail.Message) }