You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beam.apache.org by Antony Mayi <an...@yahoo.com> on 2017/03/09 08:46:17 UTC

exceptions in PTransform

Hi,
when implementing PTransform.expand what can I do with checked exceptions that might be thrown? It is not declared to throw anything checked so how can I fail it?
Thanks Antony.

Re: exceptions in PTransform

Posted by Aviem Zur <av...@gmail.com>.
Hi Antony.

You are correct, PTransform#expand cannot throw checked exceptions. What
you need to do is wrap your checked exception in a runtime exception.
For example:
https://github.com/apache/beam/blob/adba4c660ef54b98055d30ee1ad7cbf440420030/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java#L148-L148


For more information see the PTransform style guide:
https://beam.apache.org/contribute/ptransform-style-guide/#runtime-errors-and-data-consistency

Aviem.

On Thu, Mar 9, 2017 at 10:46 AM Antony Mayi <an...@yahoo.com> wrote:

> Hi,
>
> when implementing PTransform.expand what can I do with checked exceptions
> that might be thrown? It is not declared to throw anything checked so how
> can I fail it?
>
> Thanks Antony.
>