feat: add error handling

This commit is contained in:
Louis Dalibard 2024-04-27 13:50:34 +02:00
parent cc19a48c9e
commit b3e1b4f212

View File

@ -3,7 +3,6 @@ package route
import (
"leech/config"
"leech/html"
"log"
"os"
"path"
"sort"
@ -42,7 +41,7 @@ func HandleList(c *fiber.Ctx) error {
completePath := path.Join(pathSlice...)
files, err := os.ReadDir(completePath)
if err != nil {
log.Fatal(err)
return c.Status(fiber.StatusInternalServerError).SendString(err.Error())
}
entries := []html.Entry{}
for _, f := range files {