From 463cd907d0e744d5bbbd5ed5f0d0dde1bd8ca162 Mon Sep 17 00:00:00 2001 From: adityacp Date: Fri, 6 Apr 2018 15:01:01 +0530 Subject: Add error line number in error output --- yaksh/grader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'yaksh/grader.py') diff --git a/yaksh/grader.py b/yaksh/grader.py index a721236..d81470b 100644 --- a/yaksh/grader.py +++ b/yaksh/grader.py @@ -148,14 +148,15 @@ class Grader(object): error.append( prettify_exceptions("TimeoutException", self.timeout_msg) ) - except Exception: + except Exception as e: exc_type, exc_value, exc_tb = sys.exc_info() tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) + line_no = e.lineno if len(tb_list) > 2: del tb_list[1:3] error.append( prettify_exceptions( - exc_type.__name__, str(exc_value), "".join(tb_list) + exc_type.__name__, str(exc_value), "".join(tb_list), line_no=line_no ) ) finally: -- cgit