Panic on bad error usage

This commit is contained in:
世界 2023-09-27 14:53:46 +08:00
parent e781e86e32
commit 63b82af61f
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -26,14 +26,14 @@ func New(message ...any) error {
func Cause(cause error, message ...any) error {
if cause == nil {
return nil
panic("cause on an nil error")
}
return &causeError{F.ToString(message...), cause}
}
func Extend(cause error, message ...any) error {
if cause == nil {
return nil
panic("extend on an nil error")
}
return &extendedError{F.ToString(message...), cause}
}