diff options
Diffstat (limited to 'yaksh/grader.py')
-rw-r--r-- | yaksh/grader.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/yaksh/grader.py b/yaksh/grader.py index 320e7e7..c1be493 100644 --- a/yaksh/grader.py +++ b/yaksh/grader.py @@ -23,6 +23,14 @@ class TimeoutException(Exception): pass +class CompilationError(Exception): + pass + + +class TestCaseError(Exception): + pass + + @contextlib.contextmanager def change_dir(path): cur_dir = abspath(dirname(MY_DIR)) @@ -159,10 +167,14 @@ class Grader(object): line_no = traceback.extract_tb(exc_tb)[-1][1] if len(tb_list) > 2: del tb_list[1:3] + try: + exc_value = str(exc_value) + except UnicodeEncodeError: + exc_value = unicode(exc_value) error.append( prettify_exceptions( - exc_type.__name__, str(exc_value), "".join(tb_list), - line_no=line_no + exc_type.__name__, exc_value, + "".join(tb_list), line_no=line_no ) ) finally: |