Signal errors - the opposite of Pass

26 views
Skip to first unread message

Robert Gomulka

unread,
Jan 15, 2015, 4:32:15 AM1/15/15
to const...@googlegroups.com
Hi all,
There are some cases for which I'd like to raise exception.
Like, for example:
s = Struct('a',
           IfThenElse('b',
                      lambda ctx: True,  # condition
                      Pass,  # correct case, to be implemented
                      Error))  # raise exception

Currently I'm using Value for that with external function, as I can't raise exception in lambda:
def e(ctx):
    raise NotImplementedError("{} not implemented".format(ctx.data))

Error in the above would look like:
Value('error', e)

I suppose such a type would be implemented in construct (or any wrapper in my code).
Do you know any solution to that?

Regards,
Robert

Arkadiusz Bulski

unread,
Jan 11, 2018, 2:24:50 PM1/11/18
to Construct
Construct 2.8 has Check class, see docs. Also IfThenElse and Pass and Error classes.

Reply all
Reply to author
Forward
0 new messages