From 9d2b0ce603a14e95b2db83f3d2ebcd8b67d7ab90 Mon Sep 17 00:00:00 2001 From: Sparkle <1284531+baurine@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:26:50 +0800 Subject: [PATCH] fix: fix debug paramters (#1652) --- ui/packages/tidb-dashboard-for-op/.env.development | 2 +- util/rest/error_resp.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/packages/tidb-dashboard-for-op/.env.development b/ui/packages/tidb-dashboard-for-op/.env.development index 32f1fb23a3..0b2cbd7324 100644 --- a/ui/packages/tidb-dashboard-for-op/.env.development +++ b/ui/packages/tidb-dashboard-for-op/.env.development @@ -3,4 +3,4 @@ PUBLIC_URL='/dashboard' REACT_APP_VERSION=$npm_package_version REACT_APP_MIXPANEL_HOST=https://telemetry.pingcap.com/api/v1/dashboard/report REACT_APP_MIXPANEL_TOKEN= -REACT_APP_DASHBOARD_API_URL=http://127.0.0.1:2379 +REACT_APP_DASHBOARD_API_URL=http://127.0.0.1:12333 diff --git a/util/rest/error_resp.go b/util/rest/error_resp.go index e4ea6174cf..0fb0ee1a02 100644 --- a/util/rest/error_resp.go +++ b/util/rest/error_resp.go @@ -7,6 +7,8 @@ import ( "strings" "github.com/joomcode/errorx" + "github.com/pingcap/log" + "go.uber.org/zap/zapcore" ) type ErrorResponse struct { @@ -94,11 +96,16 @@ func buildDetailMessage(err error) string { } func NewErrorResponse(err error) ErrorResponse { + logLevel := log.GetLevel() + fullText := "" + if logLevel == zapcore.DebugLevel { + fullText = buildDetailMessage(err) + } return ErrorResponse{ Error: true, Message: buildSimpleMessage(err), Code: removeErrorPrefix(buildCode(err)), - // For security reasons, we need to hide detailed stacktrace info. - // FullText: buildDetailMessage(err), + // For security reasons, we need to hide detailed stacktrace info in prod. + FullText: fullText, } }