Skip to content

Commit 0d1c754

Browse files
authored
Merge pull request #11 from cockroachdb/pmattis/verify-panic
Include the recording name in the verification panic message
2 parents 6cc672c + e1c419d commit 0d1c754

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

session.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ func (s *session) VerifyRecordWithStringArg(recordTyp recordType, arg string) *r
114114
rec := s.VerifyRecord(recordTyp)
115115
if rec.Args[0].(string) != arg {
116116
panic(fmt.Errorf(
117-
"mismatched argument to %s, expected %s, got %s\n\n"+
117+
"while replaying %s\n\n"+
118+
"mismatched argument to %s, expected %s, got %s\n\n"+
118119
"Do you need to regenerate the recording with the -record flag?",
119-
recordTyp.String(), arg, rec.Args[0].(string)))
120+
s.recordingName, recordTyp.String(), arg, rec.Args[0].(string)))
120121
}
121122
return rec
122123
}
@@ -126,14 +127,18 @@ func (s *session) VerifyRecordWithStringArg(recordTyp recordType, arg string) *r
126127
func (s *session) VerifyRecord(recordTyp recordType) *record {
127128
if s.index >= len(s.recording) {
128129
panic(fmt.Errorf(
129-
"too many calls to %s\n\n"+
130-
"Do you need to regenerate the recording with the -record flag?", recordTyp.String()))
130+
"while replaying %s\n\n"+
131+
"too many calls to %s\n\n"+
132+
"Do you need to regenerate the recording with the -record flag?",
133+
s.recordingName, recordTyp.String()))
131134
}
132135
rec := s.recording[s.index]
133136
if rec.Typ != recordTyp {
134137
panic(fmt.Errorf(
135-
"unexpected call to %s\n\n"+
136-
"Do you need to regenerate the recording with the -record flag?", recordTyp.String()))
138+
"while replaying %s\n\n"+
139+
"unexpected call to %s\n\n"+
140+
"Do you need to regenerate the recording with the -record flag?",
141+
s.recordingName, recordTyp.String()))
137142
}
138143
s.index++
139144
return rec

0 commit comments

Comments
 (0)