new son_data model
This commit is contained in:
@@ -169,14 +169,16 @@ func (b *Bus) ParsePayload(c *gin.Context) error {
|
||||
|
||||
if err := c.BindJSON(b); err != nil {
|
||||
r := json_data.NewResponse()
|
||||
r.SendError("json: " + err.Error())
|
||||
r.SetError()
|
||||
r.SetMessage("json: " + err.Error())
|
||||
c.JSON(http.StatusBadRequest, r)
|
||||
return err
|
||||
}
|
||||
|
||||
if b.Name == "" {
|
||||
r := json_data.NewResponse()
|
||||
r.SendError("bus name missing")
|
||||
r.SetError()
|
||||
r.SetMessage("bus name missing")
|
||||
c.JSON(http.StatusBadRequest, r)
|
||||
return errors.New("bus name missing")
|
||||
}
|
||||
|
Reference in New Issue
Block a user