Skip to content

Commit 041a77a

Browse files
committed
chore: add error handling for router.Run
1 parent a0dfc50 commit 041a77a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

main.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,14 @@ func main() {
8080
handler(c, path)
8181
})
8282

83-
log.Println("Server started at " + host + ":" + port)
84-
router.Run(host + ":" + port)
83+
log.Println("Starting server at " + host + ":" + port)
84+
85+
err := router.Run(host + ":" + port)
86+
87+
if err != nil {
88+
log.Println("Failed to start server: ", err)
89+
os.Exit(1)
90+
}
8591
}
8692

8793
func handler(c *gin.Context, u string) {

0 commit comments

Comments
 (0)