tubes icon indicating copy to clipboard operation
tubes copied to clipboard

Where do the exceptions go?

Open exarkun opened this issue 8 years ago • 3 comments

exctube.txt

I would expect flowStopped to be called on each participant in the flow. It seems that stopped is called on the tube with the buggy received method but the exception doesn't appear to be propagated beyond that.

exarkun avatar May 02 '17 17:05 exarkun

This is definitely a bug. Effectively, the exceptions go nowhere; what's causing even the traceback-printing you're seeing is your own self._operation.addErrback.

There's some logic in tubes._siphon._Siphon._deliverFrom to catch exceptions when calling the started, stopped, and received methods, but the trouble is that usually (as in this case) the errors are raised by next() rather than the method themselves.

This logic should be refactored to apply to any part of the user code raising an exception, and therefore also be called in popPendingValue.

Does this explanation make sense?

BTW, if you're implementing your own IDrain and IFount directly, you probably should have a look at tubes.kit, particularly beginFlowingFrom and beginFlowingTo. (Yes, I know they need more docs...)

glyph avatar May 03 '17 07:05 glyph

I assume this is the same issue -- you can trigger something like this as simply as having a tube that is:

@tube
class Reverser(object):
    def received(self, item):
        asdf

Sticking that into a series appears to just silently fail.

Julian avatar Jul 22 '17 13:07 Julian

Yep, definitely a bug. A fix would be much appreciated :)

glyph avatar Jul 23 '17 08:07 glyph