Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use fatal over panic
  • Loading branch information
Emyrk committed Jan 31, 2023
commit 7fc8ead043344ea7465ce18f3d1f7562f8fd5bf2
4 changes: 3 additions & 1 deletion coderd/database/databasefake/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (g *Generator) User(ctx context.Context, seed database.User) database.User
// Populate uses `require` which calls `t.FailNow()` and must be called from the
// go routine running the test or benchmark function.
func (g *Generator) Populate(ctx context.Context, seed map[string]interface{}) map[string]interface{} {
g.testT.Helper()
db := g.db
t := g.testT

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

output[name] = link
default:
panic(fmt.Sprintf("unknown type %T", orig))
// If you hit this, just add your type to the switch.
t.Fatalf("unknown type '%T' used in fake data generator", orig)
}
}
return output
Expand Down