From 475c2b6b63bfaad3be3a2c618c2656d5851facf6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 15 Apr 2013 11:47:11 -0700 Subject: [PATCH] Use HyTypeError to raise `else' errors in `foreach' Signed-off-by: Julien Danjou --- hy/compiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index bb8ee7f..74a0fbf 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -974,8 +974,8 @@ class HyASTCompiler(object): if expression and expression[-1][0] == HySymbol("else"): else_expr = expression.pop() if len(else_expr) > 2: - # XXX use HyTypeError as soon as it lands - raise TypeError("`else' statement in `foreach' is too long") + raise HyTypeError(else_expr, + "`else' statement in `foreach' is too long") elif len(else_expr) == 2: orelse = self._code_branch( self.compile(else_expr[1]),