Improve error handling in answerHost by eliseomartelli · Pull Request #226 · apple/container

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@eliseomartelli

Copy link

Contributor

Refactor answerHost to throw descriptive DNSResolverError instances
instead of returning nil when IP allocation or parsing fails.

@makhov

Copy link

Contributor

makhov commented

Jun 17, 2025

edited

Loading

Arer you sure we need to throw errors here? As far as I understood, the server collects results from different places and return .nonExistentDomain if nothing found

https://github.com/apple/container/blob/main/Sources/DNSServer/DNSServer%2BHandle.swift#L59-L61

Refactor answerHost to throw descriptive `DNSResolverError` instances
instead of returning nil when IP  allocation or parsing fails.

@eliseomartelli eliseomartelli force-pushed the eliseomartelli/throwerrors branch from d5ab862 to 59ff0ce Compare

June 17, 2025 18:25

@eliseomartelli eliseomartelli requested a review from jglogan

June 18, 2025 13:00

@jglogan jglogan merged commit b5589f7 into apple:main

Jun 27, 2025

2 checks passed

@jglogan

Copy link

Contributor

jglogan commented

Jun 27, 2025

@eliseomartelli Sorry for the delay, I was traveling this week. Approved and merged, thanks for improving those error responses!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jglogan jglogan jglogan approved these changes

+1 more reviewer

@Abdullah4345 Abdullah4345 Abdullah4345 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@eliseomartelli @makhov @jglogan @Abdullah4345