{"action":"opened","issue":{"url":"https://api.github.com/repos/pgte/nock/issues/427","labels_url":"https://api.github.com/repos/pgte/nock/issues/427/labels{/name}","comments_url":"https://api.github.com/repos/pgte/nock/issues/427/comments","events_url":"https://api.github.com/repos/pgte/nock/issues/427/events","html_url":"https://github.com/pgte/nock/issues/427","id":122752022,"number":427,"title":"Confusing error API","user":{"login":"massimocode","id":3898363,"avatar_url":"https://avatars.githubusercontent.com/u/3898363?v=3","gravatar_id":"","url":"https://api.github.com/users/massimocode","html_url":"https://github.com/massimocode","followers_url":"https://api.github.com/users/massimocode/followers","following_url":"https://api.github.com/users/massimocode/following{/other_user}","gists_url":"https://api.github.com/users/massimocode/gists{/gist_id}","starred_url":"https://api.github.com/users/massimocode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massimocode/subscriptions","organizations_url":"https://api.github.com/users/massimocode/orgs","repos_url":"https://api.github.com/users/massimocode/repos","events_url":"https://api.github.com/users/massimocode/events{/privacy}","received_events_url":"https://api.github.com/users/massimocode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-17T14:59:41Z","updated_at":"2015-12-17T14:59:41Z","closed_at":null,"body":"Hi\r\n\r\nI have been using nock today and found the API for simulating errors via callbacks a little confusing.\r\n\r\nPlease see the attached code. There are 5 different examples. A 200, 404 and 500 as expected. However, there is then a scenario where I call the callback passing an error argument. For some reason, this does not translate into a \"hard error\" (i.e. no response from server) when making the request, it translates to a 500 server error instead! (i.e. response came back from server)\r\n\r\nAlso the last example shows me using the replyWithError convenience method, which does actually generate a \"hard error\". Why is this method named replyWithError when it does not actually simulate a response? Should it not be called throwError or something else more appropriate?\r\n\r\nThe reason I raise this issue is that the documentation on GitHub does not document usage of the error parameter of the callback. Also the documentation for replyWithError shows an example of returning JSON data, but that wouldn't really be a realistic use case for a \"hard error\".\r\n\r\nThanks\r\n\r\n[nock-examples.js.txt](https://github.com/pgte/nock/files/65499/nock-examples.js.txt)\r\n"}}