diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-25 16:00:15 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-25 16:00:15 +0100 |
commit | 8077d4729f0a148e2832f1bab3980c019d1a3191 (patch) | |
tree | d62c9e5fca93215cbab071595b1ebf98b97f4434 | |
parent | 3f9c073475628db7ae400e0df028b6b066ebf26c (diff) |
Catch exceptions in server.handlers.Hint()
Note: support for explicit Hint() requests will likely be removed.
-rw-r--r-- | server/handlers.py | 7 |
1 files 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): |