Skip to content

Commit 7fc8ead

Browse files
committed
Use fatal over panic
1 parent 3bfd4d6 commit 7fc8ead

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

coderd/database/databasefake/generator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func (g *Generator) User(ctx context.Context, seed database.User) database.User
140140
// Populate uses `require` which calls `t.FailNow()` and must be called from the
141141
// go routine running the test or benchmark function.
142142
func (g *Generator) Populate(ctx context.Context, seed map[string]interface{}) map[string]interface{} {
143+
g.testT.Helper()
143144
db := g.db
144145
t := g.testT
145146

@@ -346,7 +347,8 @@ func (g *Generator) Populate(ctx context.Context, seed map[string]interface{}) m
346347

347348
output[name] = link
348349
default:
349-
panic(fmt.Sprintf("unknown type %T", orig))
350+
// If you hit this, just add your type to the switch.
351+
t.Fatalf("unknown type '%T' used in fake data generator", orig)
350352
}
351353
}
352354
return output

0 commit comments

Comments
 (0)