diff --git a/enterprise/audit/table.go b/enterprise/audit/table.go index 139c240c9f8e1..fd7d03827829a 100644 --- a/enterprise/audit/table.go +++ b/enterprise/audit/table.go @@ -2,7 +2,9 @@ package audit import ( "fmt" + "os" "reflect" + "runtime" "github.com/coder/coder/coderd/database" "github.com/coder/coder/codersdk" @@ -235,7 +237,9 @@ func entry(v any, f map[string]Action) (string, map[string]Action) { continue } if _, ok := fcpy[jsonTag]; !ok { - panic(fmt.Sprintf("audit table entry missing action for field %q in type %q", d.FieldType.Name, name)) + _, _ = fmt.Fprintf(os.Stderr, "ERROR: Audit table entry missing action for field %q in type %q\nPlease update the auditable resource types in: %s\n", d.FieldType.Name, name, self()) + //nolint:revive + os.Exit(1) } delete(fcpy, jsonTag) } @@ -252,3 +256,9 @@ func entry(v any, f map[string]Action) (string, map[string]Action) { func (t Action) String() string { return string(t) } + +func self() string { + //nolint:dogsled + _, file, _, _ := runtime.Caller(1) + return file +}