From 33bd1b8beb6051cd04badb464cdc39809e363960 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Fri, 6 Feb 2026 13:13:44 +0800 Subject: [PATCH] fix: Refine error reporting in agent sync and fix lints. --- cmd/accountsvc/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/accountsvc/main.go b/cmd/accountsvc/main.go index 2600302..71ab8b6 100644 --- a/cmd/accountsvc/main.go +++ b/cmd/accountsvc/main.go @@ -1206,7 +1206,10 @@ func agentListUsersHandler(registry *agentserver.Registry, source xrayconfig.Cli if logger != nil { logger.Error("failed to list clients from source", "err", err, "agent", identity.ID) } - c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": "list_clients_failed", "message": "failed to list clients"}) + c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ + "error": "list_clients_failed", + "message": fmt.Sprintf("failed to list clients: %v", err), + }) return } @@ -1272,10 +1275,7 @@ func extractBearerToken(header string) string { if header == "" { return "" } - const prefix = "Bearer " - if strings.HasPrefix(header, prefix) { - header = header[len(prefix):] - } + header = strings.TrimPrefix(header, "Bearer ") return strings.TrimSpace(header) }