Skip to content

Commit

Permalink
The type of error should be *string as it comes from API and cannot b…
Browse files Browse the repository at this point in the history
…e represented as golang error type.
  • Loading branch information
petyos committed Feb 3, 2025
1 parent b6deee7 commit 3b0dbba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions driven/socialbb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (a *Adapter) GetPosts(clientID string, current *model.User, filter model.Po

type postsResponse struct {
Posts []model.Post `json:"posts"`
Error error `json:"error"`
Error *string `json:"error"`
}

var posts postsResponse
Expand All @@ -63,7 +63,12 @@ func (a *Adapter) GetPosts(clientID string, current *model.User, filter model.Po
return nil, err
}

return posts.Posts, posts.Error
var respErr error
if posts.Error != nil {
respErr = errors.New(*posts.Error)
}

return posts.Posts, respErr
}

// GetPost retrieves a post from the social BB
Expand Down

0 comments on commit 3b0dbba

Please sign in to comment.