pgte/nock — pull request #205 by mdlavin (2014-06-26 16:46:32+00:00)
Title: NetConnectNotAllowedErrors should be reported through the 'error' event, not thrown

The [documentation for http.request](http://nodejs.org/api/http.html#http_http_request_options_callback) says:

> If any error is encountered during the request (be that with DNS resolution, TCP level errors, or actual HTTP parse errors) an 'error' event is emitted on the returned request object.

I think that access to the host being blocked would fall into that situation and libraries designed to use the error event will not expect the error to be thrown. The AWS SDK is one such library, the one that caused me to find this problem.

Another example of the expectation of error reporting is in the [example code for the http.get](http://nodejs.org/api/http.html#http_http_get_options_callback) call:

```javascript
http.get("http://www.google.com/index.html", function(res) {
console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
```

With these changes, the testcases checking for errors now matches the example code from the http documentation.