Skip to content

Commit

Permalink
use InvalidLiteralTypeErr instead of NewIDLTypeNotFoundErr
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Sep 25, 2024
1 parent 5d2e062 commit c8429fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flytepropeller/pkg/compiler/errors/compiler_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestErrorCodes(t *testing.T) {
UnrecognizedValue: NewUnrecognizedValueErr("", ""),
WorkflowBuildError: NewWorkflowBuildError(errors.New("")),
NoNodesFound: NewNoNodesFoundErr(""),
IDLTypeNotFoundError: NewIDLTypeNotFoundErr("", ""),
InvalidLiteralTypeError: NewInvalidLiteralTypeErr("", ""),
}

for key, value := range testCases {
Expand Down
6 changes: 3 additions & 3 deletions flytepropeller/pkg/compiler/errors/compiler_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const (
FieldNotFoundError ErrorCode = "FieldNotFound"

// IDL not found when variable binding
IDLTypeNotFoundError ErrorCode = "IDLTypeNotFound"
InvalidLiteralTypeError ErrorCode = "InvalidLiteralType"
)

func NewBranchNodeNotSpecified(branchNodeID string) *CompileError {
Expand Down Expand Up @@ -221,9 +221,9 @@ func NewMismatchingVariablesErr(nodeID, fromVar, fromType, toVar, toType string)
)
}

func NewIDLTypeNotFoundErr(nodeID, errMsg string) *CompileError {
func NewInvalidLiteralTypeErr(nodeID, errMsg string) *CompileError {
return newError(
IDLTypeNotFoundError,
InvalidLiteralTypeError,
errMsg,
nodeID,
)
Expand Down
2 changes: 1 addition & 1 deletion flytepropeller/pkg/compiler/transformers/k8s/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func validateInputs(nodeID common.NodeID, iface *core.TypedInterface, inputs cor
err := validators.ValidateLiteralType(inputType)
if err != nil {
errMsg := fmt.Sprintf("Failed to validate literal type for [%s] with err: %s", inputVar, err)
errs.Collect(errors.NewIDLTypeNotFoundErr(nodeID, errMsg))
errs.Collect(errors.NewInvalidLiteralTypeErr(nodeID, errMsg))
continue
}

Expand Down
6 changes: 3 additions & 3 deletions flytepropeller/pkg/compiler/transformers/k8s/inputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/flyteorg/flyte/flytepropeller/pkg/compiler/errors"
)

func TestValidateInputs_IDLTypeNotFound(t *testing.T) {
func TestValidateInputs_InvalidLiteralType(t *testing.T) {
nodeID := common.NodeID("test-node")

iface := &core.TypedInterface{
Expand Down Expand Up @@ -42,13 +42,13 @@ func TestValidateInputs_IDLTypeNotFound(t *testing.T) {
idlNotFound := false
var errMsg string
for _, err := range errs.Errors().List() {
if err.Code() == "IDLTypeNotFound" {
if err.Code() == "InvalidLiteralType" {
idlNotFound = true
errMsg = err.Error()
break
}
}
assert.True(t, idlNotFound, "Expected IDLTypeNotFound error was not found in errors")
assert.True(t, idlNotFound, "Expected InvalidLiteralType error was not found in errors")

expectedContainedErrorMsg := "Failed to validate literal type"
assert.Contains(t, errMsg, expectedContainedErrorMsg)
Expand Down

0 comments on commit c8429fa

Please sign in to comment.