(c *gin.Context, statusCode int, publicMsg, errorKey string, errorParams map[string]string)
| 15 | } |
| 16 | |
| 17 | func 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 |
no outgoing calls
no test coverage detected