fix: better error string for CEL (#890)

This commit is contained in:
abelanger5
2024-09-19 12:04:37 -04:00
committed by GitHub
parent d23e5d9963
commit e72faf75fd
+7 -1
View File
@@ -111,5 +111,11 @@ func (p *CELParser) ParseAndEvalWorkflowString(workflowExp string, in WorkflowSt
return "", err
}
return out.Value().(string), nil
// Switch on the type of the output.
switch out.Type() {
case types.StringType:
return out.Value().(string), nil
default:
return "", fmt.Errorf("output must evaluate to a string: got %s", out.Type().TypeName())
}
}