Huge +1 to the
checkArgument(username != null, ...)
style. A note on validate(), aren't we trying to remove pipeline
options from PTransforms altogether (and, in addition, how does this
even work with the Runner API and cross-language transforms).
On Thu, Aug 10, 2017 at 4:59 PM, Eugene
https://beam.apache.org/contribute/ptransform-style-guide/#validation now
includes the new guidance.
It also includes updated guidance on what to put in expand() vs. validate()
(TL;DR: validate() is almost always unnecessary. Put almost all validation
in expand())
On Fri, Jul 28, 2017 at 11:56
So here's an easy solution: our own checkNotNull that throws
InvalidArgumentException with a good error message. The error message can
then be templated to allow terse invocations with just the method and
parameter.
Unsure why I didn't go for this straightaway.
On Fri, Jul 28, 2017 at 11:43 AM,
Yuck. I think that checkNotNull throwing a NPE is a very poor design choice
from the author of checkNotNull.
On Fri, Jul 28, 2017 at 11:29 AM, Kenneth Knowles
wrote:
> As to the choice of check method:
>
> - checkArgument throws an InvalidArgumentException, which is
(I don't think changing messages in existing IOs is a high priority, btw -
just a nice-to-have, as long as we have guidance for future IOs)
On Fri, Jul 28, 2017 at 11:37 AM Eugene Kirpichov
wrote:
> Okay, so then let's change guidance to:
> - Always use checkArgument to
Okay, so then let's change guidance to:
- Always use checkArgument to check stuff that the user supplied
- Use style 1 for messages on the checkArgument
?
On Fri, Jul 28, 2017 at 11:31 AM Jean-Baptiste Onofré
wrote:
> Agree
>
> Regards
> JB
>
> On Jul 28, 2017, 20:22, at
Agree
Regards
JB
On Jul 28, 2017, 20:22, at 20:22, Thomas Groh wrote:
>I'm in favor of the wording in the style of the first: it's an
>immediately
>actionable message that will have an associated stack trace, but will
>provide the parameter in plaintext so the caller
Hi
I'm a bit concerned because it has been discussed in a Jira and we discussed
especially about this with Kenn and I. It dates from the incubation period.
I changes most of the IOs I did for style 2 whereas I started with style 1.
I'm ready to change again on the IOs but we agreed that
On Fri, Jul 28, 2017 at 11:21 AM, Thomas Groh
wrote:
> I'm in favor of the wording in the style of the first: it's an immediately
> actionable message that will have an associated stack trace, but will
> provide the parameter in plaintext so the caller doesn't have to
As to the choice of check method:
- checkArgument throws an InvalidArgumentException, which is clearly in
"your fault" category, a la HTTP 4xx
- checkNotNull throws an NPE, which is usually a "my fault" exception, a
la HTTP 5xx.
The docs on NPE are not clear on blame, and this is a bug in the
I'm in favor of the wording in the style of the first: it's an immediately
actionable message that will have an associated stack trace, but will
provide the parameter in plaintext so the caller doesn't have to dig
through the invoked code, they can just look at the documentation.
I've recently
Hey all,
I think this has been discussed before on a JIRA issue but I can't find it,
so raising again on the mailing list.
Various IO (and non-IO) transforms validate their builder parameters using
Preconditions.checkArgument/checkNotNull, and use different styles for
error messages. There are 2
12 matches
Mail list logo