Extract invalid uuid error

This commit is contained in:
ErickSkrauch 2023-12-21 19:34:01 +01:00
parent e84e39eeae
commit add8ed1ab4
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -107,10 +107,12 @@ func main() {
}
}
var InvalidUuid = errors.New("invalid uuid")
func formatUuid(input string) (string, error) {
uuid := strings.ReplaceAll(input, "-", "")
if len(uuid) != 32 {
return "", errors.New("invalid uuid")
return "", InvalidUuid
}
return uuid[0:8] + "-" + uuid[8:12] + "-" + uuid[12:16] + "-" + uuid[16:20] + "-" + uuid[20:], nil