Skip to content

Commit

Permalink
Log data source functions errors
Browse files Browse the repository at this point in the history
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
  • Loading branch information
puerco committed Dec 6, 2024
1 parent 6266c2a commit 827221d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/engine/eval/rego/datasources.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/rego"
"github.com/open-policy-agent/opa/types"
"github.com/rs/zerolog/log"

v1datasources "github.com/mindersec/minder/pkg/datasources/v1"
"github.com/mindersec/minder/pkg/engine/v1/interfaces"
Expand Down Expand Up @@ -56,6 +57,7 @@ func buildFromDataSource(
}

if err := dsf.ValidateArgs(jsonObj); err != nil {
log.Error().Interface("dsfunction", k).Err(err).Msg("error validating datasource function arguments")
return nil, err
}

Expand All @@ -69,6 +71,7 @@ func buildFromDataSource(
)
ret, err := dsf.Call(ctx, jsonObj)
if err != nil {
log.Error().Interface("dsfunction", k).Err(err).Msgf("function call returned error")
return nil, err
}

Expand Down

0 comments on commit 827221d

Please sign in to comment.