[FLINK-4824] [client] CliFrontend shows misleading error message#2662
Conversation
When a Flink program throws ProgramParametrizationException the optional message is printed to stderr and the stacktrace is ignored.
|
Thanks for the PR @greghogan! Having a custom exception for missing arguments to a user program is a good approach. However, it requires the author of the program to use the custom exception. At least, we would have to adapt all the included examples. Additionally, it would be nice to throw another custom exception when no Flink job was generated during execution of the jar (which might be because of missing arguments). Currently, we simply throw a So +1 but we might do some follow-ups to fully solve the issue. |
case a message is printed to stderr without a stacktrace.
|
@mxm thanks for the review. I added a second commit which I think satisfies your request. When no job is executed then the message is printed to stderr without a stacktrace. |
mxm
left a comment
There was a problem hiding this comment.
Thanks for the update. Looks great @greghogan! We could consider removing the the zero-args constructor from ProgramParametrizationException.
+1 to merge otherwise
| * Creates a <tt>ProgramParametrizationException</tt>. | ||
| */ | ||
| public ProgramParametrizationException() { | ||
| super(); |
There was a problem hiding this comment.
I think we should not even allow to skip the message here. This will simplify the code further and display some message for the user.
| private int handleParametrizationException(ProgramParametrizationException e) { | ||
| String message = e.getMessage(); | ||
| if (message != null) { | ||
| System.err.println(message); |
There was a problem hiding this comment.
This block could be removed if we got rid of the zero-args constructor in ProgramParametrizationException.
When a command-line program is run but no Flink job is executed the message to the user is now displayed without the stacktrace. When a Flink program throws ProgramParametrizationException the optional message is printed to stderr without a stacktrace. This closes apache#2662
When a Flink program throws
ProgramParametrizationExceptionthe optional message is printed to stderr and the stacktrace is ignored.I modified Gelly's
JaccardIndexdriver to use this functionality as an example.