From 17ad67b472fbd32c875480eaedf510f647b2807f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 26 Feb 2018 12:15:08 +0100 Subject: prog: better error message when failed to create a resource --- prog/rand.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prog/rand.go b/prog/rand.go index 52409bde9..2143a4b57 100644 --- a/prog/rand.go +++ b/prog/rand.go @@ -290,7 +290,12 @@ func (r *randGen) createResource(s *state, res *ResourceType) (arg Arg, calls [] // Generally we can loop several times, e.g. when we choose a call that returns // the resource in an array, but then generateArg generated that array of zero length. // But we must succeed eventually. - panic("failed to create a resource") + var ctors []string + for _, meta := range metas { + ctors = append(ctors, meta.Name) + } + panic(fmt.Sprintf("failed to create a resource %v with %v", + res.Desc.Kind[0], strings.Join(ctors, ", "))) } func (r *randGen) generateText(kind TextKind) []byte { -- cgit mrf-deployment