Skip to content

Commit c70e7b3

Browse files
committed
change: エラーの参照方法を変更(#56)
1 parent a2a80bb commit c70e7b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

controller/user.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ func (ctrl *UserController) GetPosts(c echo.Context) error {
5151
ctx := c.Request().Context()
5252
posts, err := ctrl.uc.GetPosts(ctx, userID)
5353
if err != nil {
54-
if errors.As(err, &entity.ErrNotFound{}) {
55-
return echo.NewHTTPError(http.StatusNotFound, err.Error())
54+
errNF := &entity.ErrNotFound{}
55+
if errors.As(err, errNF) {
56+
return echo.NewHTTPError(http.StatusNotFound, errNF.Error())
5657
}
5758

5859
logger.Errorf("error GET /user/{userID}/post: %s", err.Error())

0 commit comments

Comments
 (0)