{"action":"created","comment":{"url":"https://api.github.com/repos/MailCore/mailcore2/pulls/comments/58389870","id":58389870,"diff_hunk":"@@ -56,8 +58,24 @@ - (void)operationCompleted\n     if (_completionBlock == NULL)\n         return;\n     \n-    NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()];\n-    _completionBlock(error);\n+    nativeType *op = MCO_NATIVE_INSTANCE;","path":"src/objc/smtp/MCOSMTPLoginOperation.mm","position":15,"original_position":15,"commit_id":"972e261e9dd58c4ca36152037da9882f2c3ffffb","original_commit_id":"972e261e9dd58c4ca36152037da9882f2c3ffffb","user":{"login":"dinhviethoa","id":332168,"avatar_url":"https://avatars.githubusercontent.com/u/332168?v=3","gravatar_id":"","url":"https://api.github.com/users/dinhviethoa","html_url":"https://github.com/dinhviethoa","followers_url":"https://api.github.com/users/dinhviethoa/followers","following_url":"https://api.github.com/users/dinhviethoa/following{/other_user}","gists_url":"https://api.github.com/users/dinhviethoa/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhviethoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhviethoa/subscriptions","organizations_url":"https://api.github.com/users/dinhviethoa/orgs","repos_url":"https://api.github.com/users/dinhviethoa/repos","events_url":"https://api.github.com/users/dinhviethoa/events{/privacy}","received_events_url":"https://api.github.com/users/dinhviethoa/received_events","type":"User","site_admin":false},"body":"Could you actually create in MCOSMTPOperation+Private.h, a method:\r\n\r\n```\r\n- (NSError *) error\r\n{\r\n    NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()];\r\n   if (error != nil) {\r\n        MCOSMTPSession *session = [self session];\r\n        if (nativeOp->lastSMTPResponse() || nativeOp->lastSMTPResponseCode()) {\r\n            NSMutableDictionary * userInfo = [[error userInfo] mutableCopy];\r\n            if (nativeOp->lastSMTPResponse()) {\r\n                userInfo[MCOSMTPResponseKey] = MCO_TO_OBJC(nativeOp->lastSMTPResponse());\r\n            }\r\n            if (nativeOp->lastSMTPResponseCode()) {\r\n                userInfo[MCOSMTPResponseCodeKey] = @(session nativeOp());\r\n            }\r\n            error = [NSError errorWithDomain:[error domain] code:[error code] userInfo:userInfo];\r\n        }\r\n   }\r\n  return error;\r\n}\r\n```\r\n\r\nAnd use that method everywhere that code is duplicated.","created_at":"2016-04-04T15:00:22Z","updated_at":"2016-04-04T15:00:22Z","html_url":"https://github.com/MailCore/mailcore2/pull/1393#discussion_r58389870","pull_request_url":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393","_links":{"self":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/comments/58389870"},"html":{"href":"https://github.com/MailCore/mailcore2/pull/1393#discussion_r58389870"},"pull_request":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393"}}},"pull_request":{"url":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393","id":64801066,"html_url":"https://github.com/MailCore/mailcore2/pull/1393","diff_url":"https://github.com/MailCore/mailcore2/pull/1393.diff","patch_url":"https://github.com/MailCore/mailcore2/pull/1393.patch","issue_url":"https://api.github.com/repos/MailCore/mailcore2/issues/1393","number":1393,"state":"open","locked":false,"title":"Expose SMTP response and response code to Objective-C API","user":{"login":"kolyuchiy","id":898625,"avatar_url":"https://avatars.githubusercontent.com/u/898625?v=3","gravatar_id":"","url":"https://api.github.com/users/kolyuchiy","html_url":"https://github.com/kolyuchiy","followers_url":"https://api.github.com/users/kolyuchiy/followers","following_url":"https://api.github.com/users/kolyuchiy/following{/other_user}","gists_url":"https://api.github.com/users/kolyuchiy/gists{/gist_id}","starred_url":"https://api.github.com/users/kolyuchiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolyuchiy/subscriptions","organizations_url":"https://api.github.com/users/kolyuchiy/orgs","repos_url":"https://api.github.com/users/kolyuchiy/repos","events_url":"https://api.github.com/users/kolyuchiy/events{/privacy}","received_events_url":"https://api.github.com/users/kolyuchiy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-31T14:38:09Z","updated_at":"2016-04-04T15:00:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d339b735b5134adda304c8c64d5fee0dd7a9393","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393/commits","review_comments_url":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393/comments","review_comment_url":"https://api.github.com/repos/MailCore/mailcore2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MailCore/mailcore2/issues/1393/comments","statuses_url":"https://api.github.com/repos/MailCore/mailcore2/statuses/972e261e9dd58c4ca36152037da9882f2c3ffffb","head":{"label":"kolyuchiy:expose-smtp-response","ref":"expose-smtp-response","sha":"972e261e9dd58c4ca36152037da9882f2c3ffffb","user":{"login":"kolyuchiy","id":898625,"avatar_url":"https://avatars.githubusercontent.com/u/898625?v=3","gravatar_id":"","url":"https://api.github.com/users/kolyuchiy","html_url":"https://github.com/kolyuchiy","followers_url":"https://api.github.com/users/kolyuchiy/followers","following_url":"https://api.github.com/users/kolyuchiy/following{/other_user}","gists_url":"https://api.github.com/users/kolyuchiy/gists{/gist_id}","starred_url":"https://api.github.com/users/kolyuchiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolyuchiy/subscriptions","organizations_url":"https://api.github.com/users/kolyuchiy/orgs","repos_url":"https://api.github.com/users/kolyuchiy/repos","events_url":"https://api.github.com/users/kolyuchiy/events{/privacy}","received_events_url":"https://api.github.com/users/kolyuchiy/received_events","type":"User","site_admin":false},"repo":{"id":51077892,"name":"mailcore2","full_name":"kolyuchiy/mailcore2","owner":{"login":"kolyuchiy","id":898625,"avatar_url":"https://avatars.githubusercontent.com/u/898625?v=3","gravatar_id":"","url":"https://api.github.com/users/kolyuchiy","html_url":"https://github.com/kolyuchiy","followers_url":"https://api.github.com/users/kolyuchiy/followers","following_url":"https://api.github.com/users/kolyuchiy/following{/other_user}","gists_url":"https://api.github.com/users/kolyuchiy/gists{/gist_id}","starred_url":"https://api.github.com/users/kolyuchiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolyuchiy/subscriptions","organizations_url":"https://api.github.com/users/kolyuchiy/orgs","repos_url":"https://api.github.com/users/kolyuchiy/repos","events_url":"https://api.github.com/users/kolyuchiy/events{/privacy}","received_events_url":"https://api.github.com/users/kolyuchiy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kolyuchiy/mailcore2","description":"MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.","fork":true,"url":"https://api.github.com/repos/kolyuchiy/mailcore2","forks_url":"https://api.github.com/repos/kolyuchiy/mailcore2/forks","keys_url":"https://api.github.com/repos/kolyuchiy/mailcore2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kolyuchiy/mailcore2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kolyuchiy/mailcore2/teams","hooks_url":"https://api.github.com/repos/kolyuchiy/mailcore2/hooks","issue_events_url":"https://api.github.com/repos/kolyuchiy/mailcore2/issues/events{/number}","events_url":"https://api.github.com/repos/kolyuchiy/mailcore2/events","assignees_url":"https://api.github.com/repos/kolyuchiy/mailcore2/assignees{/user}","branches_url":"https://api.github.com/repos/kolyuchiy/mailcore2/branches{/branch}","tags_url":"https://api.github.com/repos/kolyuchiy/mailcore2/tags","blobs_url":"https://api.github.com/repos/kolyuchiy/mailcore2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kolyuchiy/mailcore2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kolyuchiy/mailcore2/git/refs{/sha}","trees_url":"https://api.github.com/repos/kolyuchiy/mailcore2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kolyuchiy/mailcore2/statuses/{sha}","languages_url":"https://api.github.com/repos/kolyuchiy/mailcore2/languages","stargazers_url":"https://api.github.com/repos/kolyuchiy/mailcore2/stargazers","contributors_url":"https://api.github.com/repos/kolyuchiy/mailcore2/contributors","subscribers_url":"https://api.github.com/repos/kolyuchiy/mailcore2/subscribers","subscription_url":"https://api.github.com/repos/kolyuchiy/mailcore2/subscription","commits_url":"https://api.github.com/repos/kolyuchiy/mailcore2/commits{/sha}","git_commits_url":"https://api.github.com/repos/kolyuchiy/mailcore2/git/commits{/sha}","comments_url":"https://api.github.com/repos/kolyuchiy/mailcore2/comments{/number}","issue_comment_url":"https://api.github.com/repos/kolyuchiy/mailcore2/issues/comments{/number}","contents_url":"https://api.github.com/repos/kolyuchiy/mailcore2/contents/{+path}","compare_url":"https://api.github.com/repos/kolyuchiy/mailcore2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kolyuchiy/mailcore2/merges","archive_url":"https://api.github.com/repos/kolyuchiy/mailcore2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kolyuchiy/mailcore2/downloads","issues_url":"https://api.github.com/repos/kolyuchiy/mailcore2/issues{/number}","pulls_url":"https://api.github.com/repos/kolyuchiy/mailcore2/pulls{/number}","milestones_url":"https://api.github.com/repos/kolyuchiy/mailcore2/milestones{/number}","notifications_url":"https://api.github.com/repos/kolyuchiy/mailcore2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kolyuchiy/mailcore2/labels{/name}","releases_url":"https://api.github.com/repos/kolyuchiy/mailcore2/releases{/id}","deployments_url":"https://api.github.com/repos/kolyuchiy/mailcore2/deployments","created_at":"2016-02-04T13:32:33Z","updated_at":"2016-02-04T13:32:39Z","pushed_at":"2016-04-04T10:44:39Z","git_url":"git://github.com/kolyuchiy/mailcore2.git","ssh_url":"git@github.com:kolyuchiy/mailcore2.git","clone_url":"https://github.com/kolyuchiy/mailcore2.git","svn_url":"https://github.com/kolyuchiy/mailcore2","homepage":"","size":12801,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MailCore:master","ref":"master","sha":"e9ae0191e85b4006a3cbeebf00af3e5d95a4b54c","user":{"login":"MailCore","id":3229324,"avatar_url":"https://avatars.githubusercontent.com/u/3229324?v=3","gravatar_id":"","url":"https://api.github.com/users/MailCore","html_url":"https://github.com/MailCore","followers_url":"https://api.github.com/users/MailCore/followers","following_url":"https://api.github.com/users/MailCore/following{/other_user}","gists_url":"https://api.github.com/users/MailCore/gists{/gist_id}","starred_url":"https://api.github.com/users/MailCore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MailCore/subscriptions","organizations_url":"https://api.github.com/users/MailCore/orgs","repos_url":"https://api.github.com/users/MailCore/repos","events_url":"https://api.github.com/users/MailCore/events{/privacy}","received_events_url":"https://api.github.com/users/MailCore/received_events","type":"Organization","site_admin":false},"repo":{"id":7527552,"name":"mailcore2","full_name":"MailCore/mailcore2","owner":{"login":"MailCore","id":3229324,"avatar_url":"https://avatars.githubusercontent.com/u/3229324?v=3","gravatar_id":"","url":"https://api.github.com/users/MailCore","html_url":"https://github.com/MailCore","followers_url":"https://api.github.com/users/MailCore/followers","following_url":"https://api.github.com/users/MailCore/following{/other_user}","gists_url":"https://api.github.com/users/MailCore/gists{/gist_id}","starred_url":"https://api.github.com/users/MailCore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MailCore/subscriptions","organizations_url":"https://api.github.com/users/MailCore/orgs","repos_url":"https://api.github.com/users/MailCore/repos","events_url":"https://api.github.com/users/MailCore/events{/privacy}","received_events_url":"https://api.github.com/users/MailCore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MailCore/mailcore2","description":"MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.","fork":false,"url":"https://api.github.com/repos/MailCore/mailcore2","forks_url":"https://api.github.com/repos/MailCore/mailcore2/forks","keys_url":"https://api.github.com/repos/MailCore/mailcore2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MailCore/mailcore2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MailCore/mailcore2/teams","hooks_url":"https://api.github.com/repos/MailCore/mailcore2/hooks","issue_events_url":"https://api.github.com/repos/MailCore/mailcore2/issues/events{/number}","events_url":"https://api.github.com/repos/MailCore/mailcore2/events","assignees_url":"https://api.github.com/repos/MailCore/mailcore2/assignees{/user}","branches_url":"https://api.github.com/repos/MailCore/mailcore2/branches{/branch}","tags_url":"https://api.github.com/repos/MailCore/mailcore2/tags","blobs_url":"https://api.github.com/repos/MailCore/mailcore2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MailCore/mailcore2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MailCore/mailcore2/git/refs{/sha}","trees_url":"https://api.github.com/repos/MailCore/mailcore2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MailCore/mailcore2/statuses/{sha}","languages_url":"https://api.github.com/repos/MailCore/mailcore2/languages","stargazers_url":"https://api.github.com/repos/MailCore/mailcore2/stargazers","contributors_url":"https://api.github.com/repos/MailCore/mailcore2/contributors","subscribers_url":"https://api.github.com/repos/MailCore/mailcore2/subscribers","subscription_url":"https://api.github.com/repos/MailCore/mailcore2/subscription","commits_url":"https://api.github.com/repos/MailCore/mailcore2/commits{/sha}","git_commits_url":"https://api.github.com/repos/MailCore/mailcore2/git/commits{/sha}","comments_url":"https://api.github.com/repos/MailCore/mailcore2/comments{/number}","issue_comment_url":"https://api.github.com/repos/MailCore/mailcore2/issues/comments{/number}","contents_url":"https://api.github.com/repos/MailCore/mailcore2/contents/{+path}","compare_url":"https://api.github.com/repos/MailCore/mailcore2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MailCore/mailcore2/merges","archive_url":"https://api.github.com/repos/MailCore/mailcore2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MailCore/mailcore2/downloads","issues_url":"https://api.github.com/repos/MailCore/mailcore2/issues{/number}","pulls_url":"https://api.github.com/repos/MailCore/mailcore2/pulls{/number}","milestones_url":"https://api.github.com/repos/MailCore/mailcore2/milestones{/number}","notifications_url":"https://api.github.com/repos/MailCore/mailcore2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MailCore/mailcore2/labels{/name}","releases_url":"https://api.github.com/repos/MailCore/mailcore2/releases{/id}","deployments_url":"https://api.github.com/repos/MailCore/mailcore2/deployments","created_at":"2013-01-09T19:35:49Z","updated_at":"2016-04-04T09:16:47Z","pushed_at":"2016-04-04T10:44:40Z","git_url":"git://github.com/MailCore/mailcore2.git","ssh_url":"git@github.com:MailCore/mailcore2.git","clone_url":"https://github.com/MailCore/mailcore2.git","svn_url":"https://github.com/MailCore/mailcore2","homepage":"","size":13723,"stargazers_count":1246,"watchers_count":1246,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":353,"mirror_url":null,"open_issues_count":37,"forks":353,"open_issues":37,"watchers":1246,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393"},"html":{"href":"https://github.com/MailCore/mailcore2/pull/1393"},"issue":{"href":"https://api.github.com/repos/MailCore/mailcore2/issues/1393"},"comments":{"href":"https://api.github.com/repos/MailCore/mailcore2/issues/1393/comments"},"review_comments":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393/comments"},"review_comment":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MailCore/mailcore2/pulls/1393/commits"},"statuses":{"href":"https://api.github.com/repos/MailCore/mailcore2/statuses/972e261e9dd58c4ca36152037da9882f2c3ffffb"}}}}