From 790165c73a81a9cd8d1fc842775698570a48fb0e Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 4 Apr 2023 15:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/errors/error.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/errors/error.go b/internal/errors/error.go index c873feca..cf834ae4 100644 --- a/internal/errors/error.go +++ b/internal/errors/error.go @@ -29,8 +29,12 @@ func (this *errorObj) Error() string { return s } -// 新错误 +// New 新错误 func New(errText string) error { + if !Tea.IsTesting() { + return errors.New(errText) + } + ptr, file, line, ok := runtime.Caller(1) funcName := "" if ok { @@ -45,7 +49,7 @@ func New(errText string) error { } } -// 包装已有错误 +// Wrap 包装已有错误 func Wrap(err error) error { if err == nil { return nil