mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2025-01-01 13:28:14 +00:00
统一错误处理
This commit is contained in:
parent
d2e4e44d42
commit
28851ee4ca
@ -124,12 +124,18 @@ class JudgeServer(object):
|
||||
else:
|
||||
return json.dumps({"err": "InvalidMethod", "data": None})
|
||||
return json.dumps({"err": None, "data": callback(**data)})
|
||||
except Exception as e:
|
||||
except (CompileError, TokenVerificationFailed, SPJCompileError, JudgeClientError) as e:
|
||||
logging.exception(e)
|
||||
ret = dict()
|
||||
ret["err"] = e.__class__.__name__
|
||||
ret["data"] = e.message
|
||||
return json.dumps(ret)
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
ret = dict()
|
||||
ret["err"] = "JudgeClientError"
|
||||
ret["data"] =e.__class__.__name__ + ":" + e.message
|
||||
return json.dumps(ret)
|
||||
|
||||
|
||||
urls = (
|
||||
|
Loading…
Reference in New Issue
Block a user