From e244fcb3346ffe69a6dc40f32e36a7bf5af1b356 Mon Sep 17 00:00:00 2001 From: log101 Date: Mon, 29 Jul 2024 22:47:01 +0300 Subject: [PATCH] feat: add error handling to bimg --- server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 9c69319..c884f50 100644 --- a/server.go +++ b/server.go @@ -71,8 +71,10 @@ func main() { imageName := strings.Split(file.Filename, ".")[0] imagePath := fmt.Sprintf("./public/%s.webp", imageName) imageURL := fmt.Sprintf("%s.webp", imageName) - bimg.Write(imagePath, newImage) - + err = bimg.Write(imagePath, newImage) + if err != nil { + fmt.Fprintln(os.Stderr, err) + } // Generate public uri for the image chars := uniuri.StdChars[26:52] randomUri := uniuri.NewLenChars(10, chars) @@ -132,6 +134,6 @@ func main() { }) }) - app.Listen(":3000") + app.Listen(":3456") }