{"action":"created","issue":{"url":"https://api.github.com/repos/remiprev/her/issues/313","labels_url":"https://api.github.com/repos/remiprev/her/issues/313/labels{/name}","comments_url":"https://api.github.com/repos/remiprev/her/issues/313/comments","events_url":"https://api.github.com/repos/remiprev/her/issues/313/events","html_url":"https://github.com/remiprev/her/issues/313","id":54107767,"number":313,"title":"What's \"supposed\" to happen when status is error?","user":{"login":"eggmatters","id":3791436,"avatar_url":"https://avatars.githubusercontent.com/u/3791436?v=3","gravatar_id":"","url":"https://api.github.com/users/eggmatters","html_url":"https://github.com/eggmatters","followers_url":"https://api.github.com/users/eggmatters/followers","following_url":"https://api.github.com/users/eggmatters/following{/other_user}","gists_url":"https://api.github.com/users/eggmatters/gists{/gist_id}","starred_url":"https://api.github.com/users/eggmatters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggmatters/subscriptions","organizations_url":"https://api.github.com/users/eggmatters/orgs","repos_url":"https://api.github.com/users/eggmatters/repos","events_url":"https://api.github.com/users/eggmatters/events{/privacy}","received_events_url":"https://api.github.com/users/eggmatters/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-12T21:16:01Z","updated_at":"2015-03-31T07:39:07Z","closed_at":null,"body":"I make a call to retrieve a model from an api. The call fails validation and returns a 422 (Unprocessable Entity). The body of the response is an array of arrays, with key value pairs for the attribute and associated error:\r\n```\r\n[[\"username\", \"has already been taken\"]]\r\n```\r\nIt's ugly and her/model/orm.rb throws a \"no implicit conversion of Symbol into Integer\" exception. Which I get, but the above constrruct was generated by Active Record (albeit rails 1.4). \r\n\r\nI can create a hash of those kv pairs, but then, Her merely assigns them as *valid attributes* and my controller receives a valid 200 response. What happened to the error status? Is there any hidden documentation about how Her handles error responses? "},"comment":{"url":"https://api.github.com/repos/remiprev/her/issues/comments/87979555","html_url":"https://github.com/remiprev/her/issues/313#issuecomment-87979555","issue_url":"https://api.github.com/repos/remiprev/her/issues/313","id":87979555,"user":{"login":"hubert","id":106995,"avatar_url":"https://avatars.githubusercontent.com/u/106995?v=3","gravatar_id":"","url":"https://api.github.com/users/hubert","html_url":"https://github.com/hubert","followers_url":"https://api.github.com/users/hubert/followers","following_url":"https://api.github.com/users/hubert/following{/other_user}","gists_url":"https://api.github.com/users/hubert/gists{/gist_id}","starred_url":"https://api.github.com/users/hubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hubert/subscriptions","organizations_url":"https://api.github.com/users/hubert/orgs","repos_url":"https://api.github.com/users/hubert/repos","events_url":"https://api.github.com/users/hubert/events{/privacy}","received_events_url":"https://api.github.com/users/hubert/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T07:39:07Z","updated_at":"2015-03-31T07:39:07Z","body":"Hi @eggmatters. Which middleware are you using to parse the responses you get back from the API you're calling? Based on your description of the behavior, I'd guess you're using [Her::Middleware::FirstLevelParseJSON](https://github.com/remiprev/her/blob/master/lib/her/middleware/first_level_parse_json.rb) (same as DefaultParseJSON). \r\n\r\nIf that's the case, Her will expect a hash of the model's attributes at the top level, including errors. so something like:\r\n\r\n```json\r\n{ \r\n  \"username\": \"eggmatters\",\r\n  \"email\": \"eggmatters@github.com\",\r\n  \"errors\": { \"username\": [\"has already been taken\"] }\r\n}\r\n```\r\n\r\nthere's also some examples in the [middleware specs](https://github.com/remiprev/her/blob/master/spec/middleware/first_level_parse_json_spec.rb). \r\n\r\nhope that helps!"}}