{"action":"created","issue":{"url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/37","repository_url":"https://api.github.com/repos/filipedeschamps/cep-promise","labels_url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/37/comments","events_url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/37/events","html_url":"https://github.com/filipedeschamps/cep-promise/issues/37","id":180863079,"number":37,"title":"Normalizar as interfaces de erro","user":{"login":"filipedeschamps","id":4248081,"avatar_url":"https://avatars.githubusercontent.com/u/4248081?v=3","gravatar_id":"","url":"https://api.github.com/users/filipedeschamps","html_url":"https://github.com/filipedeschamps","followers_url":"https://api.github.com/users/filipedeschamps/followers","following_url":"https://api.github.com/users/filipedeschamps/following{/other_user}","gists_url":"https://api.github.com/users/filipedeschamps/gists{/gist_id}","starred_url":"https://api.github.com/users/filipedeschamps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipedeschamps/subscriptions","organizations_url":"https://api.github.com/users/filipedeschamps/orgs","repos_url":"https://api.github.com/users/filipedeschamps/repos","events_url":"https://api.github.com/users/filipedeschamps/events{/privacy}","received_events_url":"https://api.github.com/users/filipedeschamps/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-04T11:01:05Z","updated_at":"2016-10-05T01:39:36Z","closed_at":null,"body":"Agora que temos múltiplos fornecedores desenvolvido pelo @lucianopf para versão `2.0` precisamos normalizar a interface de erro.\r\n\r\nHoje ela está alternando entre um objeto e um array:\r\n\r\n``` js\r\ncep().catch(console.log)\r\n\r\n{ type: 'type_error',\r\n  message: 'Você deve chamar o construtor utilizando uma String ou Number',\r\n  service: undefined }\r\n```\r\n\r\n``` js\r\ncep('99999999').catch(console.log)\r\n\r\n[ { type: 'range_error',\r\n    message: 'CEP inválido',\r\n    service: 'viacep' },\r\n  { type: 'range_error',\r\n    message: 'CEP não encontrado na base dos Correios',\r\n    service: 'correios' } ]\r\n```\r\n\r\nFora isso, fica aberta a pauta: qual a melhor interface de erro para minha aplicação tratar? Por exemplo:\r\n\r\n 1. Um array de objetos dos erros\r\n 2. Um objeto em que a chave é o serviço e o valor é o erro (e quando for erro por validation colocar o service algo como `library`\r\n 3. Um objeto onde o `type` é a chave\r\n 4. Um objeto que possui uma chave `errors` e dentro dela um array de erros\r\n 5. ?"},"comment":{"url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/comments/251560973","html_url":"https://github.com/filipedeschamps/cep-promise/issues/37#issuecomment-251560973","issue_url":"https://api.github.com/repos/filipedeschamps/cep-promise/issues/37","id":251560973,"user":{"login":"filipedeschamps","id":4248081,"avatar_url":"https://avatars.githubusercontent.com/u/4248081?v=3","gravatar_id":"","url":"https://api.github.com/users/filipedeschamps","html_url":"https://github.com/filipedeschamps","followers_url":"https://api.github.com/users/filipedeschamps/followers","following_url":"https://api.github.com/users/filipedeschamps/following{/other_user}","gists_url":"https://api.github.com/users/filipedeschamps/gists{/gist_id}","starred_url":"https://api.github.com/users/filipedeschamps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipedeschamps/subscriptions","organizations_url":"https://api.github.com/users/filipedeschamps/orgs","repos_url":"https://api.github.com/users/filipedeschamps/repos","events_url":"https://api.github.com/users/filipedeschamps/events{/privacy}","received_events_url":"https://api.github.com/users/filipedeschamps/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T01:39:36Z","updated_at":"2016-10-05T01:39:36Z","body":"@derekstavis este foi o caso que te falei sobre qual melhor interface de erro."}}
{"actor":{"display_login":"filipedeschamps"}}