From 8077d4729f0a148e2832f1bab3980c019d1a3191 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 25 Feb 2016 16:00:15 +0100 Subject: Catch exceptions in server.handlers.Hint() Note: support for explicit Hint() requests will likely be removed. --- server/handlers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/handlers.py b/server/handlers.py index d1ad634..2e15a0e 100644 --- a/server/handlers.py +++ b/server/handlers.py @@ -252,8 +252,11 @@ class Hint(CodeqService): if lang_session is None: request.reply({'code': 3, 'message': 'No active session exists'}) else: - hints = lang_session.hint(session.get_sid(), problem_id, program) - request.reply({'code': 0, 'message': 'ok', 'hints': hints}) + try: + hints = lang_session.hint(session.get_sid(), problem_id, program) + request.reply({'code': 0, 'message': 'ok', 'hints': hints}) + except Exception as ex: + request.reply({'code': 4, 'message': str(ex)}) class Test(CodeqService): -- cgit v1.2.1