mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 21:07:41 +03:00
Panic on bad error usage
This commit is contained in:
parent
e781e86e32
commit
63b82af61f
1 changed files with 2 additions and 2 deletions
|
@ -26,14 +26,14 @@ func New(message ...any) error {
|
||||||
|
|
||||||
func Cause(cause error, message ...any) error {
|
func Cause(cause error, message ...any) error {
|
||||||
if cause == nil {
|
if cause == nil {
|
||||||
return nil
|
panic("cause on an nil error")
|
||||||
}
|
}
|
||||||
return &causeError{F.ToString(message...), cause}
|
return &causeError{F.ToString(message...), cause}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Extend(cause error, message ...any) error {
|
func Extend(cause error, message ...any) error {
|
||||||
if cause == nil {
|
if cause == nil {
|
||||||
return nil
|
panic("extend on an nil error")
|
||||||
}
|
}
|
||||||
return &extendedError{F.ToString(message...), cause}
|
return &extendedError{F.ToString(message...), cause}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue