MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / writeAPIError

Function writeAPIError

api/errors.go:17–28  ·  view source on GitHub ↗
(c *gin.Context, statusCode int, publicMsg, errorKey string, errorParams map[string]string)

Source from the content-addressed store, hash-verified

15}
16
17func writeAPIError(c *gin.Context, statusCode int, publicMsg, errorKey string, errorParams map[string]string) {
18 resp := APIErrorResponse{
19 Error: publicMsg,
20 }
21 if errorKey != "" {
22 resp.ErrorKey = errorKey
23 }
24 if len(errorParams) > 0 {
25 resp.ErrorParams = errorParams
26 }
27 c.JSON(statusCode, resp)
28}
29
30// SafeError returns a safe error message without exposing internal details
31// It logs the actual error for debugging but returns a generic message to the client

Callers 8

SafeErrorFunction · 0.85
SafeErrorWithDetailsFunction · 0.85
SafeInternalErrorFunction · 0.85
SafeBadRequestFunction · 0.85
SafeNotFoundFunction · 0.85
SafeUnauthorizedFunction · 0.85
SafeForbiddenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected