mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix in health endpoint (error handling) and scenario duplication
This commit is contained in:
parent
e7679a79b7
commit
d6ab81a0f9
2 changed files with 15 additions and 5 deletions
|
@ -22,6 +22,7 @@
|
|||
package healthz
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -74,6 +75,7 @@ func getHealth(c *gin.Context) {
|
|||
}
|
||||
|
||||
if len(url) != 0 {
|
||||
if session != nil {
|
||||
err = session.CheckConnection()
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
|
@ -83,6 +85,14 @@ func getHealth(c *gin.Context) {
|
|||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"success:": false,
|
||||
"message": fmt.Errorf("AMQP session is nil"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Send a 204 reponse
|
||||
|
|
|
@ -57,7 +57,7 @@ func duplicateScenarioForUser(s database.Scenario, user *database.User) <-chan e
|
|||
err = db.Find(&ic, icID).Error
|
||||
|
||||
if err != nil {
|
||||
errs <- fmt.Errorf("Cannot find IC with id %d in DB, will not duplicate for User %s: %s", icID, user.Username, err)
|
||||
log.Printf("Cannot find IC with id %d in DB, will not duplicate for User %s: %s", icID, user.Username, err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue