diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index 6b81528..2688aec 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -13,9 +13,8 @@ import ( func GetThreads(c *gin.Context) { threads, err := Repositories.Posts.Get(10, 10) if err != nil { - // TODO: рендерить шаблон 500 log.Println("error:", err) - c.JSON(http.StatusOK, gin.H{"error": true}) + c.HTML(http.StatusOK, "500.html", nil) return } c.HTML(http.StatusOK, "index.html", threads) @@ -30,9 +29,8 @@ func GetThread(c *gin.Context) { } thread, err := Repositories.Posts.GetThreadByPostID(threadID) if err != nil { - // TODO: рендерить шаблон 500 log.Println("error:", err) - c.JSON(http.StatusOK, gin.H{"error": true}) + c.HTML(http.StatusOK, "500.html", nil) return } if thread == nil { diff --git a/static/images/errors/500.png b/static/images/errors/500.png new file mode 100644 index 0000000..eb0b915 Binary files /dev/null and b/static/images/errors/500.png differ diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000..013f7ef --- /dev/null +++ b/templates/500.html @@ -0,0 +1,26 @@ + +
+ {{ template "static" }} + + + {{ template "static-meta" }} + + + + + + + \ No newline at end of file