From a19c1bce2eee5a1893b4ae9c8292b0f1b2630225 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 5 Jan 2022 13:49:17 +0100 Subject: prog: make panic message more useful Output actual resource type we tried to create in the panic messages. In some cases we spoof it and it's not the original resource type. --- prog/rand.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/rand.go b/prog/rand.go index 7a7de9b4a..aea2daeb1 100644 --- a/prog/rand.go +++ b/prog/rand.go @@ -417,8 +417,8 @@ func (r *randGen) createResource(s *state, res *ResourceType, dir Dir) (arg Arg, 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, ", "))) + panic(fmt.Sprintf("failed to create a resource %v (%v) with %v", + kind, res.Desc.Kind[0], strings.Join(ctors, ", "))) } func (r *randGen) generateText(kind TextKind) []byte { -- cgit mrf-deployment