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