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

Emit dns error thrown by native code #115

Merged
merged 2 commits into from Jan 29, 2015
Merged

Emit dns error thrown by native code #115

merged 2 commits into from Jan 29, 2015

Conversation

achingbrain
Copy link
Contributor

The native dns_sd.DNSServicePRocessResult method can throw an error if there's a DNS failure, resulting in an uncaught exception and your application going down, so this pull request wraps it in a try/catch block and gets the Browser object (extends MDNSService) to emit an error event instead.

Also includes a unit test. Actually the test_functional/simple browsing test is failing at the moment but I figure better fixed in a different commit.

achingbrain added a commit to tableflip/guvnor that referenced this pull request Jan 16, 2015
@agnat
Copy link
Owner

agnat commented Jan 25, 2015

Thanks! Reviewing...

self.emit('error', e)
return
}

Copy link
Owner

Choose a reason for hiding this comment

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

Please use semicolons after statements.

@agnat
Copy link
Owner

agnat commented Jan 25, 2015

I finished my review.

Still not sure about proxyquire, though. What it does is quite neat, no question. But it sounds like it is quite a messy business. I will probably give that a glance too. Do you have long-term experience in using it? How stable is it (across different node versions)?

@achingbrain
Copy link
Contributor Author

Sorry for my delay in replying - I've somehow managed to rent a holiday apartment without WiFi. Schoolboy error.

Sorry also for the semi-colon thing - I'd mean to push the subsequent commit to a branch instead of master so didn't mean those changes to be part of this pull request. They do appear to be valid though - when using node-mdns on really flaky WiFi networks I noticed service names would occasionally come back as an empty string. I've added the extra punctuation.

As for the publishing to npm/using a git url/tarball - I've been deploying in corporate environments with silly content filter policies so sometimes github is blocked but npm isn't. Obviously in this case using github URLs won't work so it's easier to just publish the fork under a different name then delete it once pull requests are merged to the upstream version and new versions are released. Anyway I've rebased that commit out of the repo history.

Proxyquire - I've used it quite a bit. You are right it does some horrible things to require but it gets the job done. It gets 80k+ downloads a month on npm so you'd hope it's stable ;)

That said I'd rather see some sort of dependency injection so it's not necessary but that would turn into quite the rewrite.

@agnat
Copy link
Owner

agnat commented Jan 28, 2015

Sorry for my delay in replying [...] Sorry also for the semi-colon thing. [...]

No worries.

The patch looks good to me... after resolving my confusion about proxyquire. ;)

@ronkorving, care to take a second look and release the fix?

@ronkorving
Copy link
Collaborator

Looks good to me, thanks :)

ronkorving pushed a commit that referenced this pull request Jan 29, 2015
Emit dns error thrown by native code
@ronkorving ronkorving merged commit bbe01a0 into agnat:master Jan 29, 2015
@ronkorving
Copy link
Collaborator

Released

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.

None yet

3 participants