mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
feat: add 500 page
This commit is contained in:
parent
a37b8e1bae
commit
3f3f0aea19
@ -13,9 +13,8 @@ import (
|
|||||||
func GetThreads(c *gin.Context) {
|
func GetThreads(c *gin.Context) {
|
||||||
threads, err := Repositories.Posts.Get(10, 10)
|
threads, err := Repositories.Posts.Get(10, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: рендерить шаблон 500
|
|
||||||
log.Println("error:", err)
|
log.Println("error:", err)
|
||||||
c.JSON(http.StatusOK, gin.H{"error": true})
|
c.HTML(http.StatusOK, "500.html", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.HTML(http.StatusOK, "index.html", threads)
|
c.HTML(http.StatusOK, "index.html", threads)
|
||||||
@ -30,9 +29,8 @@ func GetThread(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
thread, err := Repositories.Posts.GetThreadByPostID(threadID)
|
thread, err := Repositories.Posts.GetThreadByPostID(threadID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: рендерить шаблон 500
|
|
||||||
log.Println("error:", err)
|
log.Println("error:", err)
|
||||||
c.JSON(http.StatusOK, gin.H{"error": true})
|
c.HTML(http.StatusOK, "500.html", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if thread == nil {
|
if thread == nil {
|
||||||
|
BIN
static/images/errors/500.png
Normal file
BIN
static/images/errors/500.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
26
templates/500.html
Normal file
26
templates/500.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
{{ template "static" }}
|
||||||
|
<link
|
||||||
|
href="/static/error-image.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
>
|
||||||
|
|
||||||
|
{{ template "static-meta" }}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="h-100 d-flex justify-content-center align-items-center flex-column">
|
||||||
|
<h1>500</h1>
|
||||||
|
<h1>SOMETHING IS BROKEN</h1>
|
||||||
|
<a href="/" class="error-image-link">
|
||||||
|
<img
|
||||||
|
class="error-image"
|
||||||
|
src="/static/images/errors/500.png"
|
||||||
|
alt="All broken"
|
||||||
|
>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user