| 1 | package uuidscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ |
| 2 | |
| 3 | import "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 4 | |
| 5 | // Error is a custom error type for UUID-related errors |
| 6 | type Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error# string |
| 7 | |
| 8 | // The strings defined in the errors is matching the previous behavior before |
| 9 | // the custom error type was implemented. The reason is that some people might |
| 10 | // be relying on the exact string representation to handle errors in their code. |
| 11 | const ( |
| 12 | // ErrInvalidFormat is returned when the UUID string representation does not |
| 13 | // match the expected format. See also ErrIncorrectFormatInString. |
| 14 | ErrInvalidFormatscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrInvalidFormat. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: invalid UUID format") |
| 15 | |
| 16 | // ErrIncorrectFormatInString can be returned instead of ErrInvalidFormat. |
| 17 | // A separate error type is used because of how errors used to be formatted |
| 18 | // before custom error types were introduced. |
| 19 | ErrIncorrectFormatInStringscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectFormatInString. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: incorrect UUID format in string") |
| 20 | |
| 21 | // ErrIncorrectLength is returned when the UUID does not have the |
| 22 | // appropriate string length for parsing the UUID. |
| 23 | ErrIncorrectLengthscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectLength. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: incorrect UUID length") |
| 24 | |
| 25 | // ErrIncorrectByteLength indicates the UUID byte slice length is invalid. |
| 26 | ErrIncorrectByteLengthscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectByteLength. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: UUID must be exactly 16 bytes long") |
| 27 | |
| 28 | // ErrNoHwAddressFound is returned when a hardware (MAC) address cannot be |
| 29 | // found for UUID generation. |
| 30 | ErrNoHwAddressFoundscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrNoHwAddressFound. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: no HW address found") |
| 31 | |
| 32 | // ErrTypeConvertError is returned for type conversion operation fails. |
| 33 | ErrTypeConvertErrorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrTypeConvertError. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: cannot convert") |
| 34 | |
| 35 | // ErrInvalidVersion indicates an unsupported or invalid UUID version. |
| 36 | ErrInvalidVersionscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrInvalidVersion. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid:") |
| 37 | |
| 38 | // ErrV8FieldLength indicates a V8 custom field has incorrect length. |
| 39 | ErrV8FieldLengthscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrV8FieldLength. = Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#("uuid: V8 field has incorrect length") |
| 40 | ) |
| 41 | |
| 42 | // Wrapped errors for backward compatibility. These wrap ErrIncorrectFormatInString |
| 43 | // so code like errors.Is(err, uuid.ErrIncorrectFormatInString) continues to work. |
| 44 | var ( |
| 45 | // ErrInvalidBraces is returned when braced format has invalid braces. |
| 46 | ErrInvalidBracesscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrInvalidBraces. = fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("%w: invalid braces", ErrIncorrectFormatInStringscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectFormatInString.) |
| 47 | |
| 48 | // ErrInvalidURNPrefix is returned when URN format has invalid prefix. |
| 49 | ErrInvalidURNPrefixscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrInvalidURNPrefix. = fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("%w: invalid URN prefix", ErrIncorrectFormatInStringscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectFormatInString.) |
| 50 | |
| 51 | // ErrInvalidDashes is returned when canonical format has dashes not in expected positions. |
| 52 | ErrInvalidDashesscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrInvalidDashes. = fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("%w: dashes were not in expected positions", ErrIncorrectFormatInStringscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/ErrIncorrectFormatInString.) |
| 53 | ) |
| 54 | |
| 55 | // Error returns the string representation of the UUID error. |
| 56 | func (e Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#) Errorscip-go gomod github.com/gofrs/uuid/v5 . `github.com/gofrs/uuid/v5`/Error#Error().() string { |
| 57 | return string(e) |
| 58 | } |