{"action":"closed","issue":{"url":"https://api.github.com/repos/jsonmodel/jsonmodel/issues/333","repository_url":"https://api.github.com/repos/jsonmodel/jsonmodel","labels_url":"https://api.github.com/repos/jsonmodel/jsonmodel/issues/333/labels{/name}","comments_url":"https://api.github.com/repos/jsonmodel/jsonmodel/issues/333/comments","events_url":"https://api.github.com/repos/jsonmodel/jsonmodel/issues/333/events","html_url":"https://github.com/jsonmodel/jsonmodel/issues/333","id":79447483,"number":333,"title":"Transforms sometimes fail resulting in a uncaught exception instead of an error","user":{"login":"stkhapugin","id":6065334,"avatar_url":"https://avatars.githubusercontent.com/u/6065334?v=3","gravatar_id":"","url":"https://api.github.com/users/stkhapugin","html_url":"https://github.com/stkhapugin","followers_url":"https://api.github.com/users/stkhapugin/followers","following_url":"https://api.github.com/users/stkhapugin/following{/other_user}","gists_url":"https://api.github.com/users/stkhapugin/gists{/gist_id}","starred_url":"https://api.github.com/users/stkhapugin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stkhapugin/subscriptions","organizations_url":"https://api.github.com/users/stkhapugin/orgs","repos_url":"https://api.github.com/users/stkhapugin/repos","events_url":"https://api.github.com/users/stkhapugin/events{/privacy}","received_events_url":"https://api.github.com/users/stkhapugin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jsonmodel/jsonmodel/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-05-22T13:03:23Z","updated_at":"2016-09-12T09:45:14Z","closed_at":"2016-09-12T09:45:14Z","body":"`NSDate` can be converted to and from `NSString` by means of `__NSDateFromNSString` and `__JSONObjectFromNSDate`. However, if the JSON format changes to include something instead of a string (not necessarily a front-end developer's fault), say, an `NSDictionary`, instead of correctly issuing an error and returning nil from `initWithDictionary:error:`, an uncaught exception is thrown.  \r\n\r\nCode to reproduce:\r\n```objective-c\r\n@interface User : JSONModel\r\n@property (nonatomic, strong) NSDate *birthday;\r\n@end\r\n@implementation User @end\r\n\r\nNSDictionary *goodJSON = @{@\"birthday\":@\"1992-03-15 00:00:00.000000\"};\r\nNSError *error = nil;\r\nUser *test = [[User alloc] initWithDictionary:goodJSON error:&error];\r\n// test is not nil, error is nil, everything is nice and dandy\r\n\r\nNSDictionary *badJSON = @{@\"birthday\":@{@\"date\":@\"1992-03-15 00:00:00.000000\", @\"time\":@123}};\r\nUser *anotherTest = [[User alloc] initWithDictionary:badJSON error:&error]; //< throws an exception\r\n```\r\n\r\nHere's what the comment above the `@throw` says: \"it's not a JSON data type, and there's no transformer for it if property type is not supported - that's a programmer mistaked -> exception\". I believe that a format change on the backend may not always be a programmer's mistake and in this case an error should be issued instead of an exception. What'd you say?\r\n\r\n---\r\nactually here is what our backend sent me today: \r\n```JSON\r\n\"birthday\":{\r\n                    \"date\":\"1992-03-15 00:00:00.000000\",\r\n                    \"timezone\":\"Asia/Beijing\",\r\n                    \"timezone_type\":3\r\n}\r\n```"}}
{"actor":{"display_login":"billinghamj"}}