Check errors of more database calls
This commit is contained in:
parent
a1837a4d69
commit
a09633e859
3 changed files with 28 additions and 4 deletions
15
poll.go
15
poll.go
|
@ -126,7 +126,20 @@ func (h *Headscale) PollNetMapHandler(ctx *gin.Context) {
|
|||
machine.Endpoints = req.Endpoints
|
||||
machine.LastSeen = &now
|
||||
}
|
||||
h.db.Updates(machine)
|
||||
|
||||
if err := h.db.Updates(machine).Error; err != nil {
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Str("handler", "PollNetMap").
|
||||
Str("id", ctx.Param("id")).
|
||||
Str("machine", machine.Name).
|
||||
Err(err).
|
||||
Msg("Failed to persist/update machine in the database")
|
||||
ctx.String(http.StatusInternalServerError, ":(")
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
data, err := h.getMapResponse(machineKey, req, machine)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue