{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/fetchr/issues/97","labels_url":"https://api.github.com/repos/yahoo/fetchr/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/fetchr/issues/97/comments","events_url":"https://api.github.com/repos/yahoo/fetchr/issues/97/events","html_url":"https://github.com/yahoo/fetchr/issues/97","id":87551071,"number":97,"title":"return data is lost on error","user":{"login":"lukemadera","id":1377076,"avatar_url":"https://avatars.githubusercontent.com/u/1377076?v=3","gravatar_id":"","url":"https://api.github.com/users/lukemadera","html_url":"https://github.com/lukemadera","followers_url":"https://api.github.com/users/lukemadera/followers","following_url":"https://api.github.com/users/lukemadera/following{/other_user}","gists_url":"https://api.github.com/users/lukemadera/gists{/gist_id}","starred_url":"https://api.github.com/users/lukemadera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukemadera/subscriptions","organizations_url":"https://api.github.com/users/lukemadera/orgs","repos_url":"https://api.github.com/users/lukemadera/repos","events_url":"https://api.github.com/users/lukemadera/events{/privacy}","received_events_url":"https://api.github.com/users/lukemadera/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-06-12T00:25:41Z","updated_at":"2015-07-21T19:50:47Z","closed_at":null,"body":"Following the standard node convention, a callback with a non-null first argument signifies an error and often there is valuable error information passed back. However, in the current implementation, on error, the data is lost (overwritten with `message: err.message || 'request failed'`).\r\n\r\nhttps://github.com/yahoo/fetchr/blob/master/libs/fetcher.js#L109\r\n\r\nThis is a significant issue since we are currently trying to validate form input fields and need a key value error object of errors per input. More generally, whatever error information or data is supplied should be passed through.\r\nAny particular reason neither error nor data are passed through?\r\n\r\nSolution should be pretty simple, such as:\r\n\r\n```js\r\nif (err) {\r\n  res.status(err.statusCode || 400).json(err);\r\n  return;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/yahoo/fetchr/issues/comments/123459920","html_url":"https://github.com/yahoo/fetchr/issues/97#issuecomment-123459920","issue_url":"https://api.github.com/repos/yahoo/fetchr/issues/97","id":123459920,"user":{"login":"Bazze","id":1932208,"avatar_url":"https://avatars.githubusercontent.com/u/1932208?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazze","html_url":"https://github.com/Bazze","followers_url":"https://api.github.com/users/Bazze/followers","following_url":"https://api.github.com/users/Bazze/following{/other_user}","gists_url":"https://api.github.com/users/Bazze/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazze/subscriptions","organizations_url":"https://api.github.com/users/Bazze/orgs","repos_url":"https://api.github.com/users/Bazze/repos","events_url":"https://api.github.com/users/Bazze/events{/privacy}","received_events_url":"https://api.github.com/users/Bazze/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T19:50:47Z","updated_at":"2015-07-21T19:50:47Z","body":"@jeffkole: Have you done any progress on this? I'm in the same situation as you and really need to pass with validation errors to the client. However, I'm not sure if I agree with you that it's a good idea to respond to erroneous requests (i.e. requests containing data with invalid data) with a 200 status code. Did you continue with that approach?"}}