Improve "constraint violation" error message.

This commit is contained in:
Jerzy Szczepkowski
2015-02-04 23:41:27 +01:00
parent 63c07ad58b
commit ad4c2ee630
3 changed files with 16 additions and 10 deletions

View File

@@ -214,8 +214,8 @@ func (r *Registry) assignPod(ctx api.Context, podID string, machine string) erro
err = r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
boundPodList := in.(*api.BoundPods)
boundPodList.Items = append(boundPodList.Items, *boundPod)
if !constraint.Allowed(boundPodList.Items) {
return nil, fmt.Errorf("the assignment would cause a constraint violation")
if e := constraint.Allowed(boundPodList.Items); e != nil {
return nil, fmt.Errorf("the assignment would cause the following constraint violation: %v", e)
}
return boundPodList, nil
})