fix: code execution node not display clear reasons when sandbox res error (#6830)

This commit is contained in:
非法操作 2024-08-02 15:36:44 +08:00 committed by GitHub
parent 62cc4077bb
commit bf3f1027c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,11 +107,11 @@ class CodeExecutor:
response = response.json()
except:
raise CodeExecutionException('Failed to parse response')
if (code := response.get('code')) != 0:
raise CodeExecutionException(f"Got error code: {code}. Got error msg: {response.get('message')}")
response = CodeExecutionResponse(**response)
if response.code != 0:
raise CodeExecutionException(response.message)
if response.data.error:
raise CodeExecutionException(response.data.error)