error handling in agent parsing
All checks were successful
Pipeline was successful

This commit is contained in:
2023-11-10 21:14:49 +01:00
parent 24be598758
commit 6a63daab73
2 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,10 @@
package utils
import "math/rand"
import (
"math/rand"
log "github.com/sirupsen/logrus"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
@ -15,3 +19,11 @@ func RandStringBytes(n int) string {
func BoolPointer(b bool) *bool {
return &b
}
func CheckError(err error, caller string) {
if err != nil {
log.WithFields(log.Fields{
"Caller": caller,
}).Warnf("Error from hetzner API: %s", err.Error())
}
}