feat: replace all panic by response err (#1993)

* fix: missing return after response error

* feat: handle error in frontend

* feat: disable loading and catch org edit error

* chore: i18 for error message

* chore: remove break line

* feat: application catching error
This commit is contained in:
Trần Thanh Tịnh
2023-06-27 20:33:47 +07:00
committed by GitHub
parent 0a8c2a35fe
commit cd7589775c
60 changed files with 416 additions and 155 deletions

View File

@ -41,7 +41,8 @@ func (c *ApiController) GetSessions() {
if limit == "" || page == "" {
sessions, err := object.GetSessions(owner)
if err != nil {
panic(err)
c.ResponseError(err.Error())
return
}
c.Data["json"] = sessions
@ -76,7 +77,8 @@ func (c *ApiController) GetSingleSession() {
session, err := object.GetSingleSession(id)
if err != nil {
panic(err)
c.ResponseError(err.Error())
return
}
c.Data["json"] = session
@ -155,7 +157,8 @@ func (c *ApiController) IsSessionDuplicated() {
isUserSessionDuplicated, err := object.IsSessionDuplicated(id, sessionId)
if err != nil {
panic(err)
c.ResponseError(err.Error())
return
}
c.Data["json"] = &Response{Status: "ok", Msg: "", Data: isUserSessionDuplicated}