Check all errors for db.Save
This commit is contained in:
parent
405de9e0f8
commit
52cc3bc8eb
4 changed files with 45 additions and 13 deletions
|
@ -57,7 +57,10 @@ func (h *Headscale) CreateAPIKey(
|
|||
Hash: hash,
|
||||
Expiration: expiration,
|
||||
}
|
||||
h.db.Save(&key)
|
||||
|
||||
if err := h.db.Save(&key).Error; err != nil {
|
||||
return "", nil, fmt.Errorf("failed to save API key to database: %w", err)
|
||||
}
|
||||
|
||||
return keyStr, &key, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue