{"action":"created","issue":{"url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/10","repository_url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert","labels_url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/10/comments","events_url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/10/events","html_url":"https://github.com/inakianduaga/scala-play-car-advert/issues/10","id":177534462,"number":10,"title":"Add validation to model constructors","user":{"login":"inakianduaga","id":4490289,"avatar_url":"https://avatars.githubusercontent.com/u/4490289?v=3","gravatar_id":"","url":"https://api.github.com/users/inakianduaga","html_url":"https://github.com/inakianduaga","followers_url":"https://api.github.com/users/inakianduaga/followers","following_url":"https://api.github.com/users/inakianduaga/following{/other_user}","gists_url":"https://api.github.com/users/inakianduaga/gists{/gist_id}","starred_url":"https://api.github.com/users/inakianduaga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inakianduaga/subscriptions","organizations_url":"https://api.github.com/users/inakianduaga/orgs","repos_url":"https://api.github.com/users/inakianduaga/repos","events_url":"https://api.github.com/users/inakianduaga/events{/privacy}","received_events_url":"https://api.github.com/users/inakianduaga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-16T22:39:23Z","updated_at":"2016-09-16T23:47:21Z","closed_at":null,"body":"For both models we can do validation on the constructor by using something like\r\n\r\nhttp://stackoverflow.com/questions/20478588/scala-case-class-how-to-validate-constructors-parameters\r\n\r\nThen we can see if we return `Option/Maybe` or `Try`\r\n\r\n**Update:** Better to use `Try` to handle possible validation exceptions\r\n\r\nhttp://danielwestheide.com/blog/2012/12/26/the-neophytes-guide-to-scala-part-6-error-handling-with-try.html"},"comment":{"url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/comments/247733469","html_url":"https://github.com/inakianduaga/scala-play-car-advert/issues/10#issuecomment-247733469","issue_url":"https://api.github.com/repos/inakianduaga/scala-play-car-advert/issues/10","id":247733469,"user":{"login":"inakianduaga","id":4490289,"avatar_url":"https://avatars.githubusercontent.com/u/4490289?v=3","gravatar_id":"","url":"https://api.github.com/users/inakianduaga","html_url":"https://github.com/inakianduaga","followers_url":"https://api.github.com/users/inakianduaga/followers","following_url":"https://api.github.com/users/inakianduaga/following{/other_user}","gists_url":"https://api.github.com/users/inakianduaga/gists{/gist_id}","starred_url":"https://api.github.com/users/inakianduaga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inakianduaga/subscriptions","organizations_url":"https://api.github.com/users/inakianduaga/orgs","repos_url":"https://api.github.com/users/inakianduaga/repos","events_url":"https://api.github.com/users/inakianduaga/events{/privacy}","received_events_url":"https://api.github.com/users/inakianduaga/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T23:47:21Z","updated_at":"2016-09-16T23:47:21Z","body":"# TODO:\r\n\r\n- [ ] The validation method should return a Try[None] instead of a boolean, where the exception is wrapped. That way we can propagate the exception so we know what the validation error was"}}
{"actor":{"display_login":"inakianduaga"}}