From 70af8b57acb0915030cdf9080dacaff24639c399 Mon Sep 17 00:00:00 2001 From: Hylke Visser Date: Wed, 10 Aug 2022 15:25:51 +0200 Subject: [PATCH] is: Panic on invalid entity types in entityStore --- pkg/identityserver/bunstore/entity_store.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/identityserver/bunstore/entity_store.go b/pkg/identityserver/bunstore/entity_store.go index 45f5107314..91919b43fc 100644 --- a/pkg/identityserver/bunstore/entity_store.go +++ b/pkg/identityserver/bunstore/entity_store.go @@ -51,6 +51,8 @@ func (s *entityStore) query(ctx context.Context, entityType string, entityIDs .. var query *bun.SelectQuery switch entityType { + default: + panic(fmt.Errorf("invalid entity type: %s", entityType)) case "application": query = s.newSelectModel(ctx, &Application{}). Column("id"). @@ -137,6 +139,8 @@ func (s *entityStore) getEntityID(ctx context.Context, entityType, entityUUID st var query *bun.SelectQuery switch entityType { + default: + panic(fmt.Errorf("invalid entity type: %s", entityType)) case "application": query = s.newSelectModel(ctx, &Application{}). Column("application_id").