Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

DNS — Throw meaningful error(s). #7070

Closed
19h opened this issue Feb 7, 2014 · 3 comments
Closed

DNS — Throw meaningful error(s). #7070

19h opened this issue Feb 7, 2014 · 3 comments

Comments

@19h
Copy link

19h commented Feb 7, 2014

(1) Assertion: dns.resolveNs([])

    Assertion failed: (args[1]->IsString()), function Query, file ../src/cares_wrap.cc, line 845.

(2) Callbacks: dns.resolve("test.com", [], new Function) should raise an error if argument[1] isn't of type function. (instead of crashing against the wall)

@19h
Copy link
Author

19h commented Feb 7, 2014

https://github.com/joyent/node/blob/master/lib/dns.js#L185-L191 asserts argument[1] to be string or it will be evaluated as function.

@19h
Copy link
Author

19h commented Feb 7, 2014

Wupps, GitHub doesn't do well with a retroactively cleaned-up history for PRs it seems.

indutny pushed a commit that referenced this issue Feb 7, 2014
Don't use argument as callback if it's not a valid callback function.
Throw a valid exception instead explaining the issue. Adds to #7070
("DNS — Throw meaningful error(s)").
@19h
Copy link
Author

19h commented Feb 7, 2014

This looks like a minefield.. hopefully none ever will see it again 👶

@indutny indutny closed this as completed in 56e80a3 Feb 9, 2014
indutny pushed a commit that referenced this issue Feb 9, 2014
Don't use argument as callback if it's not a valid callback function.
Throw a valid exception instead explaining the issue.

Adds to #7070 ("DNS — Throw meaningful error(s)").
indutny pushed a commit that referenced this issue Feb 9, 2014
Mitigate C++-land assertion error, add test accordingly.

Fix #7070
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant