Error 返回错误响应
(c *gin.Context, statusCode int, message string)
| 58 | |
| 59 | // Error 返回错误响应 |
| 60 | func Error(c *gin.Context, statusCode int, message string) { |
| 61 | c.JSON(statusCode, Response{ |
| 62 | Code: statusCode, |
| 63 | Message: message, |
| 64 | Reason: "", |
| 65 | Metadata: nil, |
| 66 | }) |
| 67 | } |
| 68 | |
| 69 | // ErrorWithDetails returns an error response compatible with the existing envelope while |
| 70 | // optionally providing structured error fields (reason/metadata). |
no outgoing calls