Skip to content

Commit

Permalink
feat: refactor API error handling and logging
Browse files Browse the repository at this point in the history
- Changed the error handling for starting the API
- Added a log message when unable to start the API

Signed-off-by: Corentin Barreau <corentin@archive.org>
  • Loading branch information
CorentinB committed Aug 23, 2023
1 parent 64c8ec5 commit 0497d26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/pkg/crawl/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ func (crawl *Crawl) startAPI() {
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
}

r.Run(":" + crawl.APIPort)
err := r.Run(":" + crawl.APIPort)
if err != nil {
logError.Fatalf("unable to start API: %s", err.Error())
}
}

0 comments on commit 0497d26

Please sign in to comment.