diff options
author | adityacp | 2016-09-01 14:48:51 +0530 |
---|---|---|
committer | adityacp | 2016-09-01 14:48:51 +0530 |
commit | 3f4fd6ec0369b3285cc5f4f8f095c2d4b760fe85 (patch) | |
tree | 20b63a661101a8c63b0d7c2d4eeade4e815a26e8 /yaksh/code_evaluator.py | |
parent | aefc8eed3b0c18520059b4005978f1db9cf5591b (diff) | |
download | online_test-3f4fd6ec0369b3285cc5f4f8f095c2d4b760fe85.tar.gz online_test-3f4fd6ec0369b3285cc5f4f8f095c2d4b760fe85.tar.bz2 online_test-3f4fd6ec0369b3285cc5f4f8f095c2d4b760fe85.zip |
changed format of tracebacks
Diffstat (limited to 'yaksh/code_evaluator.py')
-rw-r--r-- | yaksh/code_evaluator.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py index 2fb429f..d0cac62 100644 --- a/yaksh/code_evaluator.py +++ b/yaksh/code_evaluator.py @@ -108,9 +108,14 @@ class CodeEvaluator(object): except TimeoutException: err = self.timeout_msg + except OSError: + msg = traceback.format_exc(limit=0) + err = "Error: {0}".format(msg) except Exception: - err = "Error: {0}".format(traceback.format_exc(limit=0)) - + exc_type, exc_value, exc_tb = sys.exc_info() + tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) + del tb_list[1:3] + err = "Error: {0}".format("".join(tb_list)) finally: # Set back any original signal handler. set_original_signal_handler(prev_handler) |