Skip to content

Commit 5285a69

Browse files
committed
fix(serializer): handle missing topics and correct variable naming
1 parent e0ccb15 commit 5285a69

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

protocol/serializer/generate_log_dir.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ import (
1010
)
1111

1212
func GenerateLogDirs(logger *logger.Logger, topics []string) error {
13-
topicData := []common.TopicConfig{}
13+
topicsData := []common.TopicConfig{}
1414
for _, topicName := range topics {
15-
topicData = append(topicData, common.TOPICS[topicName])
15+
topicData, ok := common.TOPICS[topicName]
16+
if !ok {
17+
panic(fmt.Sprintf("CodeCrafters Internal Error: topic %s not found", topicName))
18+
}
19+
topicsData = append(topicsData, topicData)
1620
}
1721

18-
return generateLogDirs(logger, len(topics) == 0, topicData)
22+
return generateLogDirs(logger, len(topics) == 0, topicsData)
1923
}
2024

2125
// GenerateLogDirs generates the log directories and files for the test cases.

0 commit comments

Comments
 (0)