mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: change error number.
This commit is contained in:
parent
ff3ecb36d4
commit
d68acede6f
|
|
@ -119,7 +119,7 @@ sys.stdout.flush()
|
|||
result = json.loads(result_line[-1].split(":", 1)[1])
|
||||
if result.get('code') == 200:
|
||||
return result.get('data')
|
||||
raise Exception(result.get('msg'))
|
||||
raise Exception(result.get('msg') + (f'\n{subprocess_result.stderr}' if subprocess_result.stderr else ''))
|
||||
|
||||
def _generate_mcp_server_code(self, _code, params):
|
||||
# 解析代码,提取导入语句和函数定义
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
|
|||
|
||||
if (is_sandbox_user() && banned_hosts && *banned_hosts) {
|
||||
if (ip[0] && match_banned_ip(ip, banned_hosts)) {
|
||||
fprintf(stderr, "[sandbox] 🚫 Access to IP %s is banned\n", ip);
|
||||
fprintf(stderr, "Permission denied to access %s.\n", ip);
|
||||
errno = EACCES; // Permission denied
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -188,8 +188,9 @@ int getaddrinfo(const char *node, const char *service,
|
|||
if (!is_ip) {
|
||||
// 仅对域名进行阻塞
|
||||
if (match_banned_domain(node, banned_hosts)) {
|
||||
fprintf(stderr, "[sandbox] 🚫 Access to host %s is banned (DNS blocked)\n", node);
|
||||
return EAI_FAIL;
|
||||
fprintf(stderr, "Permission denied to access %s.\n", node);
|
||||
errno = EACCES;
|
||||
return EAI_SYSTEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue