Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ops/net): fix panic in op_dns_resolve #9187

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jan 20, 2021

Deno.resolveDns() panics with non registered dns record. This PR changes it to JS error.

$ ./target/debug/deno run --unstable -A https://deno.land/posts/v1.7/dig.ts not-found-example.com
error: Uncaught (in promise) Error: no record found for name: not-found-example.com.local. type: A class: IN
    throw new ErrorClass(res.err.message);
          ^
    at processResponse (deno:core/core.js:212:11)
    at Object.jsonOpAsync (deno:core/core.js:229:12)
    at async https://deno.land/posts/v1.7/dig.ts:6:17

closes #9186

@magurotuna
Copy link
Member

Thanks so much for the fix! I should have taken this case into account...

I think this is fine for the moment, but in the future, at latest before this API gets stabilized, it should return the cause of the error as precise as it can.
Looking at the other languages, in the case of failure, Golang returns DNSError type, and Node.js returns Error object with these error codes. It would be nice if we returned errors likewise.

@kt3k
Copy link
Member Author

kt3k commented Jan 20, 2021

Looking at the other languages, in the case of failure, Golang returns DNSError type, and Node.js returns Error object with these error codes. It would be nice if we returned errors likewise.

Sounds reasonable to me 👍 Let's do that in follow up issues.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 0a159be into denoland:master Jan 20, 2021
@kt3k kt3k deleted the fix/fix-panic-dns-not-found branch January 20, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deno.resolveDns panics with non registered domain records
4 participants