diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -146,17 +146,19 @@ class Subterm: make_attributes_from_args('submaster', 'subexpr') def scaled(self, t): subexpr_eval = self.subexpr.eval(t) - # this stops an error that didn't used to happen. i think when - # the expr is empty, subexpr_eval becomes None, so this zero - # is ok - if subexpr_eval is None: - subexpr_eval = 0 - if isinstance(subexpr_eval, Submaster.Submaster): - # if the expression returns a submaster, just return it - return subexpr_eval - else: - # otherwise, return our submaster multiplied by the value returned - return self.submaster * subexpr_eval + # we prevent any exceptions from escaping, since they cause us to + # stop sending levels + try: + if isinstance(subexpr_eval, Submaster.Submaster): + # if the expression returns a submaster, just return it + return subexpr_eval + else: + # otherwise, return our submaster multiplied by the value + # returned + return self.submaster * subexpr_eval + except Exception, e: + dispatcher.send("expr_error", sender=self.subexpr, exc=str(e)) + return Submaster.Submaster('Error: %s' % str(e), temporary=True) class Subtermview(tk.Frame): def __init__(self,master,st,**kw):