-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.go
More file actions
28 lines (23 loc) · 862 Bytes
/
error.go
File metadata and controls
28 lines (23 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//go:build go1.21
// +build go1.21
package passwd
// very good point and advice
// https://dave.cheney.net/2016/04/07/constant-errors
// also avoid your error checks can be diverted cross packages
// when in usage in the rest of an package ecosystem
// Error is the type helping defining errors as constants.
type Error string
func (e Error) Error() string { return string(e) }
const (
errSalt = Error("salt error")
// ErrParse when a parse error happened
ErrParse = Error("parse error")
// ErrHash when a hashing error occurs
ErrHash = Error("hash error")
// ErrUnsupported when a feature is not supported
ErrUnsupported = Error("unsupported")
// ErrMismatch is returned when Compare() call does not match
ErrMismatch = Error("mismatch")
// ErrUnsafe is to notify of password hashing parameters strength
ErrUnsafe = Error("unsafe parameters")
)