blob: 0182ec68cd9271358235b3a9091067cc7b4afed8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package errorsx
// String representing an error, useful for declaring string constants as errors.
type String string
func (t String) Error() string {
return string(t)
}
// Is reports whether String matches with the target error
func (t String) Is(target error) bool {
if target == nil {
return false
}
return t.Error() == target.Error()
}
|