From 196a236dadbed8f73141085a002f0c24a06c72cd Mon Sep 17 00:00:00 2001 From: AoiHosizora Date: Thu, 16 Jul 2020 16:05:58 +0800 Subject: [PATCH] feat(error): update skip++ --- xdto/error.go | 4 +++- xfiber/dump.go | 1 + xgin/dump.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xdto/error.go b/xdto/error.go index 5fcddce..4ac00cb 100644 --- a/xdto/error.go +++ b/xdto/error.go @@ -24,12 +24,14 @@ type ErrorDto struct { // Build a basic dto (only include time, type, detail, request) // noinspection GoUnusedExportedFunction func BuildBasicErrorDto(err interface{}, requests []string) *ErrorDto { - return BuildErrorDto(err, requests, -1, false) + return BuildErrorDto(err, requests, -2, false) } // Build a complete dto (also include runtime parameters) // noinspection GoUnusedExportedFunction func BuildErrorDto(err interface{}, requests []string, skip int, print bool) *ErrorDto { + skip++ + now := time.Now().Format(time.RFC3339) errType := fmt.Sprintf("%T", err) errDetail := fmt.Sprintf("%v", err) diff --git a/xfiber/dump.go b/xfiber/dump.go index 34136ec..b4c9760 100644 --- a/xfiber/dump.go +++ b/xfiber/dump.go @@ -31,5 +31,6 @@ func BuildBasicErrorDto(err interface{}, c *fiber.Ctx) *xdto.ErrorDto { // noinspection GoUnusedExportedFunction func BuildErrorDto(err interface{}, c *fiber.Ctx, skip int, print bool) *xdto.ErrorDto { + skip++ return xdto.BuildErrorDto(err, DumpRequest(c), skip, print) } diff --git a/xgin/dump.go b/xgin/dump.go index 4395a2e..cf07f44 100644 --- a/xgin/dump.go +++ b/xgin/dump.go @@ -32,5 +32,6 @@ func BuildBasicErrorDto(err interface{}, c *gin.Context) *xdto.ErrorDto { // noinspection GoUnusedExportedFunction func BuildErrorDto(err interface{}, c *gin.Context, skip int, print bool) *xdto.ErrorDto { + skip++ return xdto.BuildErrorDto(err, DumpRequest(c), skip, print) }