From add8ed1ab4442d9c8c0b7b346333f431a41bdb88 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Thu, 21 Dec 2023 19:34:01 +0100 Subject: [PATCH] Extract invalid uuid error --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 83c8e80..914b31e 100644 --- a/main.go +++ b/main.go @@ -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