feat: add error handling
This commit is contained in:
parent
cc19a48c9e
commit
b3e1b4f212
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user