Skip to content

Commit

Permalink
fix: better error handling in the transformerfactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Huck committed Nov 1, 2023
1 parent c0d2d8b commit cd8e7c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/sync/transformer.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package sync

import (
"fmt"
"strings"

"github.com/charmbracelet/log"

"github.com/inovex/CalendarSync/internal/config"
"github.com/inovex/CalendarSync/internal/models"
"github.com/inovex/CalendarSync/internal/transformation"
Expand Down Expand Up @@ -58,8 +59,8 @@ var (
func TransformerFactory(configuredTransformers []config.Transformer) (loadedTransformers []Transformer) {
for _, configuredTransformer := range configuredTransformers {
if _, nameExists := transformerConfigMapping[configuredTransformer.Name]; !nameExists {
// todo: handle properly
panic(fmt.Sprintf("unknown transformer: %s", configuredTransformer.Name))
log.Warnf("unknown transformer: %s, skipping..", configuredTransformer.Name)
continue
}
// load the default Transformer for the configured name and initialize it based on the config
transformerDefault := transformerConfigMapping[configuredTransformer.Name]
Expand Down

0 comments on commit cd8e7c3

Please sign in to comment.