Skip to content

Commit

Permalink
Don't Crash on Request Error
Browse files Browse the repository at this point in the history
This patch prevents the application from crashing if the opencast server
can not be reached, for example, due to a network outage.
  • Loading branch information
lkiesow committed Feb 1, 2024
1 parent 7c2aea7 commit f05dcc9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func setupRouter() *gin.Engine {
req.SetBasicAuth(config.Opencast.Username, config.Opencast.Password)
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
c.JSON(http.StatusBadGateway, nil)
return
}
bodyText, err := ioutil.ReadAll(resp.Body)
s := string(bodyText)
Expand Down

0 comments on commit f05dcc9

Please sign in to comment.