mirror of
https://github.com/elyby/accounts-profiles-endpoint.git
synced 2024-12-22 13:09:51 +05:30
Extract invalid uuid error
This commit is contained in:
parent
e84e39eeae
commit
add8ed1ab4
4
main.go
4
main.go
@ -107,10 +107,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var InvalidUuid = errors.New("invalid uuid")
|
||||||
|
|
||||||
func formatUuid(input string) (string, error) {
|
func formatUuid(input string) (string, error) {
|
||||||
uuid := strings.ReplaceAll(input, "-", "")
|
uuid := strings.ReplaceAll(input, "-", "")
|
||||||
if len(uuid) != 32 {
|
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
|
return uuid[0:8] + "-" + uuid[8:12] + "-" + uuid[12:16] + "-" + uuid[16:20] + "-" + uuid[20:], nil
|
||||||
|
Loading…
Reference in New Issue
Block a user