mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-06 21:37:38 +03:00
Fix cause error with nil
This commit is contained in:
parent
59e662e6e2
commit
ad6dd0aa7b
1 changed files with 6 additions and 0 deletions
|
@ -25,10 +25,16 @@ func New(message ...any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Cause(cause error, message ...any) error {
|
func Cause(cause error, message ...any) error {
|
||||||
|
if cause == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
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 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return &extendedError{F.ToString(message...), cause}
|
return &extendedError{F.ToString(message...), cause}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue