mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 15:31:24 +02:00
Cleaned up some validation code, stricter validation
This commit is contained in:
@@ -19,6 +19,13 @@ func Errorf(format string, args ...any) Error {
|
||||
return &baseError{fmt.Errorf(format, args...)}
|
||||
}
|
||||
|
||||
func Wrap(err error, message ...string) Error {
|
||||
if len(message) == 0 || message[0] == "" {
|
||||
return From(err)
|
||||
}
|
||||
return Errorf("%w: %s", err, message[0])
|
||||
}
|
||||
|
||||
func From(err error) Error {
|
||||
if err == nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user