aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rand.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-26 12:15:08 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-26 12:15:08 +0100
commit17ad67b472fbd32c875480eaedf510f647b2807f (patch)
tree7c9179c187bc0f190fb8a14ed0e9e9376bedd644 /prog/rand.go
parentafccdb6cffa7bec1fb677819f3e721a0762c3e8a (diff)
prog: better error message when failed to create a resource
Diffstat (limited to 'prog/rand.go')
-rw-r--r--prog/rand.go7
1 files changed, 6 insertions, 1 deletions
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 {