Skip to content

Commit

Permalink
Merge pull request #16 from PickHD/bugfix/err-handling
Browse files Browse the repository at this point in the history
Fixing error handling on blog services
  • Loading branch information
PickHD committed May 2, 2022
2 parents b56fda3 + 9e526ae commit cf7ea94
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/blog.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ func (bs *BlogService) UpdateBlogSvc(id int, req model.UpdateBlogRequest, update
if err == pgx.ErrNoRows {
return model.ErrBlogNotFound
}

return err
}

blogMap,err := validateUpdateBlogRequest(currentBlog,&req)
Expand All @@ -216,6 +218,8 @@ func (bs *BlogService) DeleteBlogSvc(id int,userID int) error {
if err == pgx.ErrNoRows {
return model.ErrBlogNotFound
}

return err
}

if currentBlog.UserID != userID {
Expand Down

0 comments on commit cf7ea94

Please sign in to comment.