new son_data model

This commit is contained in:
Adrian Zürcher
2025-05-05 07:32:26 +02:00
parent a92995d766
commit dc64d08e9d
5 changed files with 28 additions and 19 deletions

View File

@@ -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")
}