From 84fc3c4e329097e73769c19dc7401d22f6732570 Mon Sep 17 00:00:00 2001 From: pangdogs Date: Sat, 19 Oct 2024 23:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E9=94=99=E8=AF=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/exception/errors.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/exception/errors.go b/utils/exception/errors.go index c538e19..49a0c72 100644 --- a/utils/exception/errors.go +++ b/utils/exception/errors.go @@ -48,9 +48,11 @@ func Errorf(format string, args ...any) error { } func Panic(v any) { - panic(Error(v)) + _, file, line, _ := runtime.Caller(1) + panic(fmt.Errorf("%v (%s:%d)", v, file, line)) } func Panicf(format string, args ...any) { - panic(Errorf(format, args...)) + _, file, line, _ := runtime.Caller(1) + panic(fmt.Errorf(format+" (%s:%d)", append(args, file, line)...)) }