优化home模块页面错误处理

This commit is contained in:
孟帅
2023-06-15 20:40:19 +08:00
parent 5abfeb5485
commit 2d0d7e5604
14 changed files with 509 additions and 397 deletions

View File

@@ -6,9 +6,11 @@
package charset
import (
"bytes"
"crypto/rand"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gutil"
r "math/rand"
"strings"
"time"
@@ -48,6 +50,16 @@ func ParseStack(st string) []string {
return stack
}
// SerializeStack 解析错误并序列化堆栈信息
func SerializeStack(err error) string {
buffer := bytes.NewBuffer(nil)
gutil.DumpTo(buffer, ParseErrStack(err), gutil.DumpOption{
WithType: false,
ExportedOnly: false,
})
return buffer.String()
}
// SubstrAfter 截取指定字符后的内容
func SubstrAfter(str string, symbol string) string {
comma := strings.Index(str, symbol)