Improve error message for MismatchingTypes#5639
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5639 +/- ##
==========================================
+ Coverage 36.17% 36.19% +0.01%
==========================================
Files 1302 1302
Lines 109484 109627 +143
==========================================
+ Hits 39609 39677 +68
- Misses 65737 65803 +66
- Partials 4138 4147 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kevin Su <pingsutw@apache.org>
eapolinario
left a comment
There was a problem hiding this comment.
This is easily one of the most useful PRs coming out of this effort to improve error messages. Thank you for working on it!
|
|
||
| errs.Collect(errors.NewMismatchingTypesErr(nodeID, val.Promise.Var, sourceType.String(), expectedType.String())) | ||
| errs.Collect(errors.NewMismatchingTypesErr(node.GetId(), outputVar, sourceType.String(), inputVar, expectedType.String())) | ||
| return nil, nil, !errs.HasErrors() |
There was a problem hiding this comment.
yup, outputVar is a promise.
| if len(toVar) == 0 { | ||
| errMsg = fmt.Sprintf("Variable [%v] (type [%v]) doesn't match expected type [%v].", fromVar, fromType, | ||
| toType) | ||
| } else { | ||
| errMsg = fmt.Sprintf("The output variable '%v' has type [%v], but it's assigned to"+ | ||
| " the input variable '%v' which has type type [%v].", fromVar, fromType, toVar, toType) |
There was a problem hiding this comment.
Should we have 2 different functions instead? One to handle the previous case and another one to handle the new case where toVar is set.
There was a problem hiding this comment.
that's better. updated it, thanks~
Signed-off-by: Kevin Su <pingsutw@apache.org>
| func NewMismatchingVariablesErr(nodeID, fromVar, fromType, toVar, toType string) *CompileError { | ||
| return newError( | ||
| MismatchingTypes, | ||
| fmt.Sprintf("The output variable '%v' has type [%v], but it's assigned to the input variable '%v' which has type type [%v].", fromVar, fromType, toVar, toType), |
There was a problem hiding this comment.
The output variable ... the input variable
The upstream variable ... the downstream variable
Do you think it will be better?
There was a problem hiding this comment.
Wait, I think the version now is better.
Details: failed to compile workflow for [resource_type:WORKFLOW project:"flytesnacks" domain:"development" name:"example.wf3" version:"ArJxfyEQms9wkDQCL-2Tpw"] with err: Collected Errors: 1
Error 0: Code: MismatchingTypes, Node Id: n1, Description: The output variable 'subwf1.o0' has type [simple:INTEGER], but it's assigned to the input variable 't2.a' which has type type [simple:STRING].|
I'm a little bit tired today, let me review this PR tomorrow morning when I'm energetic. |
Future-Outlier
left a comment
There was a problem hiding this comment.
LGTM, this is super helpful.
* wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * update tests Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Kevin Su <pingsutw@apache.org> * address comment Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Future-Outlier <eric901201@gmail.com> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> * fix ci Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: Kevin Su <pingsutw@apache.org> Signed-off-by: Future-Outlier <eric901201@gmail.com> Co-authored-by: Future-Outlier <eric901201@gmail.com> Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com>
* wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * update tests Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Kevin Su <pingsutw@apache.org> * address comment Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Future-Outlier <eric901201@gmail.com> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> * fix ci Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: Kevin Su <pingsutw@apache.org> Signed-off-by: Future-Outlier <eric901201@gmail.com> Co-authored-by: Future-Outlier <eric901201@gmail.com> Signed-off-by: Bugra Gedik <bgedik@gmail.com>
* wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * wip Signed-off-by: Kevin Su <pingsutw@apache.org> * update tests Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Kevin Su <pingsutw@apache.org> * address comment Signed-off-by: Kevin Su <pingsutw@apache.org> * fix tests Signed-off-by: Future-Outlier <eric901201@gmail.com> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> * fix ci Signed-off-by: Kevin Su <pingsutw@apache.org> * lint Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: Kevin Su <pingsutw@apache.org> Signed-off-by: Future-Outlier <eric901201@gmail.com> Co-authored-by: Future-Outlier <eric901201@gmail.com>
Tracking issue
NA
Why are the changes needed?
The compilation error message is not clear to users. The error message only shows the node ID, so users don't know which task/workflow has problems.
What changes were proposed in this pull request?
Add task/workflow name to the error message.
How was this patch tested?
Setup process
Screenshots
Related PRs
NA
Docs link
NA