Skip to content

Commit

Permalink
Merge pull request #77 from bmf-san/feature/refactor-execute-tpl
Browse files Browse the repository at this point in the history
WriteHeaderの根本対応
  • Loading branch information
bmf-san authored Sep 12, 2023
2 parents 23dae8c + 028152f commit b6bd7a1
Show file tree
Hide file tree
Showing 18 changed files with 181 additions and 70 deletions.
12 changes: 6 additions & 6 deletions app/controller/category_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -46,7 +46,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -57,7 +57,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -68,7 +68,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -78,7 +78,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -93,7 +93,7 @@ func (cc *CategoryController) Index() http.Handler {
cc.Logger.Error(err.Error())
if err := cc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
cc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
6 changes: 3 additions & 3 deletions app/controller/feed_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (fc *FeedController) Index() http.Handler {
fc.Logger.Error(err.Error())
if err := fc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
fc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -50,7 +50,7 @@ func (fc *FeedController) Index() http.Handler {
fc.Logger.Error(err.Error())
if err := fc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
fc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -61,7 +61,7 @@ func (fc *FeedController) Index() http.Handler {
fc.Logger.Error(err.Error())
if err := fc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
fc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
10 changes: 5 additions & 5 deletions app/controller/home_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (hc *HomeController) Index() http.Handler {
hc.Logger.Error(err.Error())
if err := hc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
hc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -46,7 +46,7 @@ func (hc *HomeController) Index() http.Handler {
hc.Logger.Error(err.Error())
if err := hc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
hc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -57,7 +57,7 @@ func (hc *HomeController) Index() http.Handler {
hc.Logger.Error(err.Error())
if err := hc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
hc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -68,7 +68,7 @@ func (hc *HomeController) Index() http.Handler {
hc.Logger.Error(err.Error())
if err := hc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
hc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -79,7 +79,7 @@ func (hc *HomeController) Index() http.Handler {
hc.Logger.Error(err.Error())
if err := hc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
hc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
56 changes: 28 additions & 28 deletions app/controller/post_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -50,7 +50,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -61,7 +61,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -72,7 +72,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -82,7 +82,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -97,7 +97,7 @@ func (pc *PostController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -112,7 +112,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -123,7 +123,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -134,7 +134,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -145,7 +145,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -155,7 +155,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -171,7 +171,7 @@ func (pc *PostController) IndexByKeyword() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -186,7 +186,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -197,7 +197,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -208,7 +208,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -219,7 +219,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -229,7 +229,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -245,7 +245,7 @@ func (pc *PostController) IndexByCategory() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -260,7 +260,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -271,7 +271,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -282,7 +282,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -293,7 +293,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -303,7 +303,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -319,7 +319,7 @@ func (pc *PostController) IndexByTag() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -336,7 +336,7 @@ func (pc *PostController) Show() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -347,7 +347,7 @@ func (pc *PostController) Show() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -358,7 +358,7 @@ func (pc *PostController) Show() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand All @@ -370,7 +370,7 @@ func (pc *PostController) Show() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion app/controller/privacy_policy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (pc *PrivacyPolicyController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion app/controller/profile_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (pc *ProfileController) Index() http.Handler {
pc.Logger.Error(err.Error())
if err := pc.Presenter.ExecuteError(w, http.StatusInternalServerError); err != nil {
pc.Logger.Error(err.Error())
w.Write([]byte(err.Error()))
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
Expand Down
Loading

0 comments on commit b6bd7a1

Please sign in to comment.