Improve error message for server.accept() failures

Enhanced the error message to include:
- The actual file descriptor number that failed
- Guidance on common failure causes (invalid socket FD, SSL mismatch)

This helps users diagnose issues more quickly when accept() fails.

Addresses CodeRabbit review comment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-10-16 21:05:51 +00:00
parent 33efd885ec
commit 32ad95aa34

View File

@@ -1835,7 +1835,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d
const result = app.accept(bun.FileDescriptor.fromUV(@intCast(fd)));
if (result != 0) {
return globalThis.throwInvalidArguments("Failed to accept file descriptor", .{});
return globalThis.throwInvalidArguments("Failed to accept file descriptor {d}. Ensure it is a valid socket file descriptor and matches the server's SSL configuration.", .{fd});
}
return .js_undefined;