feat(be/settings): add api for reporting client error

This commit is contained in:
hexxa 2021-12-27 16:52:30 +08:00 committed by Hexxa
parent 4fd9bd9c33
commit 7577fb0ace
5 changed files with 67 additions and 2 deletions

View file

@ -77,3 +77,20 @@ func validateClientCfg(cfg *sitestore.ClientConfig) error {
}
return nil
}
type ClientErrorReport struct {
Report string `json:"report"`
Version string `json:"version"`
}
func (h *SettingsSvc) ReportError(c *gin.Context) {
var err error
req := &ClientErrorReport{}
if err = c.ShouldBindJSON(&req); err != nil {
c.JSON(q.ErrResp(c, 400, err))
return
}
h.deps.Log().Errorf("version:%s,error:%s", req.Version, req.Report)
c.JSON(q.Resp(200))
}