mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Pubdash: Verify affected rows count in database 'create' call (#59591)
* make create call consistent with update and delete * use appropriate error type * update log statements * update error log for 0 affected rows
This commit is contained in:
parent
7f92f1df00
commit
8152b0e1ef
@ -168,9 +168,11 @@ func (pd *PublicDashboardServiceImpl) Create(ctx context.Context, u *user.Signed
|
||||
},
|
||||
}
|
||||
|
||||
_, err = pd.store.Create(ctx, cmd)
|
||||
affectedRows, err := pd.store.Create(ctx, cmd)
|
||||
if err != nil {
|
||||
return nil, ErrInternalServerError.Errorf("Create: failed to create the public dashboard: %w", err)
|
||||
return nil, ErrInternalServerError.Errorf("Create: failed to create the public dashboard with Uid %s: %w", uid, err)
|
||||
} else if affectedRows == 0 {
|
||||
return nil, ErrInternalServerError.Errorf("Create: failed to create a database entry for public dashboard with Uid %s. 0 rows changed, no error reported.", uid)
|
||||
}
|
||||
|
||||
//Get latest public dashboard to return
|
||||
|
Loading…
Reference in New Issue
Block a user