Skip to content

Commit d68aced

Browse files
refactor: change error number.
1 parent ff3ecb3 commit d68aced

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

apps/common/utils/tool_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def exec_code(self, code_str, keywords, function_name=None):
119119
result = json.loads(result_line[-1].split(":", 1)[1])
120120
if result.get('code') == 200:
121121
return result.get('data')
122-
raise Exception(result.get('msg'))
122+
raise Exception(result.get('msg') + (f'\n{subprocess_result.stderr}' if subprocess_result.stderr else ''))
123123

124124
def _generate_mcp_server_code(self, _code, params):
125125
# 解析代码,提取导入语句和函数定义

installer/sandbox.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
166166

167167
if (is_sandbox_user() && banned_hosts && *banned_hosts) {
168168
if (ip[0] && match_banned_ip(ip, banned_hosts)) {
169-
fprintf(stderr, "[sandbox] 🚫 Access to IP %s is banned\n", ip);
169+
fprintf(stderr, "Permission denied to access %s.\n", ip);
170170
errno = EACCES; // Permission denied
171171
return -1;
172172
}
@@ -188,8 +188,9 @@ int getaddrinfo(const char *node, const char *service,
188188
if (!is_ip) {
189189
// 仅对域名进行阻塞
190190
if (match_banned_domain(node, banned_hosts)) {
191-
fprintf(stderr, "[sandbox] 🚫 Access to host %s is banned (DNS blocked)\n", node);
192-
return EAI_FAIL;
191+
fprintf(stderr, "Permission denied to access %s.\n", node);
192+
errno = EACCES;
193+
return EAI_SYSTEM;
193194
}
194195
}
195196
}

0 commit comments

Comments
 (0)