Could it possible to add strict mode for nodes?

Hi, KNIMEer,

What I mean strict mode is, fail the node in some situation(like waring …).

e.g.:
Like Math Formula, you can divide by 0 in this node, and get the missing value as result.(And without any warning!)

But sometimes I do not what the missing value, I just want the node to be failed. Then I can use try ... catch structure to wrap the node and do something …

It seems at this time, I can use Java related nodes only? Writing some throw new Abort(....) code?

Do we have some better solution about this common problem?

Thanks,

1 Like

Hi @HaveF , not sure if there are “better” solution, but as an alternative if you don’t want to use Java, you can always either check the denominator value before the Math Formula, or check for missing values after the Math Formula and take the appropriate action.

And if the appropriate action if to stop the workflow, you can force your workflow to fail with the Fail in execution node:

1 Like

Hello @HaveF,

for example given I would probably use if() function inside Math Formula node to check denominator for 0 and then take appropriate action either check the denominator value before the Math Formula node as suggested by @bruno29a.

Believe catching warnings (when there are ones) with Try/Catch nodes could be one approach. Added +1 to existing ticket. (Internal reference: AP-14264)

Br,
Ivan

1 Like

Hey @ipazin , I think it would be more about switching from warning to an error/fail rather than catching warnings. In theory, you can’t catch warnings as they’re not exceptions.

With the strict approach, a division by zero would be evaluated and should fail, that’s where the try/catch would then be able to catch it.

3 Likes

Hello @bruno29a,

maybe it makes sense to have “strict” mode. Let’s see.

Br,
Ivan

1 Like

Thanks for your reply.

Divide by 0 is only a example. There are lots of situation like this, like, tanh, log, etc.

Thanks for ticket, as @bruno29a said, I believe warning to an error/fail is a better way.

I saw a post about parse log to catch warning, I do believe that is a another topic :slight_smile:

Btw, why does some nodes not complain at console? Like divide 0. Do I missing something?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.