Skip to content

Commit

Permalink
Include error message in panic output in main (#152)
Browse files Browse the repository at this point in the history
Adding better error handling
  • Loading branch information
EinarLogi authored Dec 18, 2023
1 parent 2f1faad commit 9f133be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/template/framework/files/main/fiber_main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ func main() {
port, _ := strconv.Atoi(os.Getenv("PORT"))
err := server.Listen(fmt.Sprintf(":%d", port))
if err != nil {
panic("cannot start server")
panic(fmt.Sprintf("cannot start server: %s", err))
}
}
3 changes: 2 additions & 1 deletion cmd/template/framework/files/main/main.go.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"{{.ProjectName}}/internal/server"
)

Expand All @@ -10,6 +11,6 @@ func main() {

err := server.ListenAndServe()
if err != nil {
panic("cannot start server")
panic(fmt.Sprintf("cannot start server: %s", err))
}
}

0 comments on commit 9f133be

Please sign in to comment.