aboutsummaryrefslogtreecommitdiff
path: root/routes/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'routes/api.go')
-rw-r--r--routes/api.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routes/api.go b/routes/api.go
index 2fb0f3f..080d88d 100644
--- a/routes/api.go
+++ b/routes/api.go
@@ -6,6 +6,7 @@ import (
"time"
"github.com/FChannel0/FChannel-Server/config"
+ "github.com/FChannel0/FChannel-Server/util"
"github.com/gofiber/fiber/v2"
)
@@ -20,7 +21,7 @@ func Media(c *fiber.Ctx) error {
func RouteImages(ctx *fiber.Ctx, media string) error {
req, err := http.NewRequest("GET", config.MediaHashs[media], nil)
if err != nil {
- return err
+ return util.MakeError(err, "RouteImages")
}
client := http.Client{
@@ -29,18 +30,18 @@ func RouteImages(ctx *fiber.Ctx, media string) error {
resp, err := client.Do(req)
if err != nil {
- return err
+ return util.MakeError(err, "RouteImages")
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
fileBytes, err := ioutil.ReadFile("./static/notfound.png")
if err != nil {
- return err
+ return util.MakeError(err, "RouteImages")
}
_, err = ctx.Write(fileBytes)
- return err
+ return util.MakeError(err, "RouteImages")
}
body, _ := ioutil.ReadAll(resp.Body)