Fix cause error with nil

This commit is contained in:
世界 2023-04-17 12:26:06 +08:00
parent 59e662e6e2
commit ad6dd0aa7b
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -25,10 +25,16 @@ func New(message ...any) error {
}
func Cause(cause error, message ...any) error {
if cause == nil {
return nil
}
return &causeError{F.ToString(message...), cause}
}
func Extend(cause error, message ...any) error {
if cause == nil {
return nil
}
return &extendedError{F.ToString(message...), cause}
}