{"action":"closed","number":12,"pull_request":{"url":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12","id":70990805,"html_url":"https://github.com/getsentry/sentry-swift/pull/12","diff_url":"https://github.com/getsentry/sentry-swift/pull/12.diff","patch_url":"https://github.com/getsentry/sentry-swift/pull/12.patch","issue_url":"https://api.github.com/repos/getsentry/sentry-swift/issues/12","number":12,"state":"closed","locked":false,"title":"add method to capture NSError","user":{"login":"ahti","id":644764,"avatar_url":"https://avatars.githubusercontent.com/u/644764?v=3","gravatar_id":"","url":"https://api.github.com/users/ahti","html_url":"https://github.com/ahti","followers_url":"https://api.github.com/users/ahti/followers","following_url":"https://api.github.com/users/ahti/following{/other_user}","gists_url":"https://api.github.com/users/ahti/gists{/gist_id}","starred_url":"https://api.github.com/users/ahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahti/subscriptions","organizations_url":"https://api.github.com/users/ahti/orgs","repos_url":"https://api.github.com/users/ahti/repos","events_url":"https://api.github.com/users/ahti/events{/privacy}","received_events_url":"https://api.github.com/users/ahti/received_events","type":"User","site_admin":false},"body":"This PR introduces a method to capture NSErrors. It's a WIP and I'd appreciate any feedback. It also doesn't include any tests yet.\r\n\r\n### Message content\r\n\r\n`raven-swift` and `raven-objc` have similar methods. This implementation, unlike theirs, does not send the errors description as message, as I find that to have bad readability and it may exceed the limit of 1000 characters for the message.\r\n\r\nInstead, it sends messages similar to this:\r\n\r\n    NSURLErrorDomain.-1004 in SomeFile.swift:99 someFunc(_:params:)\r\n\r\nI'd like to send a more readable error name, but the only thing available at runtime is `localizedDescription`, which can be in any number of languages.\r\n\r\nA possibility to do this would be to ship a dictionary that maps error domains and codes to their respective names, but generating such a dictionary automatically is not trivial and maintaining it manually seems unfeasible (there are at least 57 error domains in the iOS 9.3 SDK).\r\n\r\n### userInfo\r\n\r\nIn addition, the `userInfo` dictionary is cleaned to be convertible to JSON and sent in `extra[\"user_info\"]`.\r\n\r\nI'm not a fan of how I implemented this and I'd love suggestions on how it could be done better. I've tried to integrate this into the `EventSerializable` protocol, but couldn't make it work due to the infamous `Protocol 'EventSerializable' can only be used as a generic constraint because it has Self or associated type requirements. `.\r\n\r\n### Source location\r\n\r\nI added `#file`, `#line` and `#function` parameters to the capture function. We might want to extend this to other functions and also send a single-frame stacktrace (this is what the other frameworks do), as the culprit doesn't seem to be displayed anywhere.\r\n\r\nI have also not yet tested how (if at all) this is usable from Objective-C.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/getsentry/sentry-swift/12)\n<!-- Reviewable:end -->\n","created_at":"2016-05-22T22:39:50Z","updated_at":"2016-07-21T19:34:05Z","closed_at":"2016-07-21T19:34:05Z","merged_at":"2016-07-21T19:34:05Z","merge_commit_sha":"9d70bcc8d05053876107de1864887ce92ea77c82","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12/commits","review_comments_url":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12/comments","review_comment_url":"https://api.github.com/repos/getsentry/sentry-swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getsentry/sentry-swift/issues/12/comments","statuses_url":"https://api.github.com/repos/getsentry/sentry-swift/statuses/d69e9c0474a4a5003174769a848a7c151087ecde","head":{"label":"ahti:nserror","ref":"nserror","sha":"d69e9c0474a4a5003174769a848a7c151087ecde","user":{"login":"ahti","id":644764,"avatar_url":"https://avatars.githubusercontent.com/u/644764?v=3","gravatar_id":"","url":"https://api.github.com/users/ahti","html_url":"https://github.com/ahti","followers_url":"https://api.github.com/users/ahti/followers","following_url":"https://api.github.com/users/ahti/following{/other_user}","gists_url":"https://api.github.com/users/ahti/gists{/gist_id}","starred_url":"https://api.github.com/users/ahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahti/subscriptions","organizations_url":"https://api.github.com/users/ahti/orgs","repos_url":"https://api.github.com/users/ahti/repos","events_url":"https://api.github.com/users/ahti/events{/privacy}","received_events_url":"https://api.github.com/users/ahti/received_events","type":"User","site_admin":false},"repo":{"id":59342045,"name":"sentry-swift","full_name":"ahti/sentry-swift","owner":{"login":"ahti","id":644764,"avatar_url":"https://avatars.githubusercontent.com/u/644764?v=3","gravatar_id":"","url":"https://api.github.com/users/ahti","html_url":"https://github.com/ahti","followers_url":"https://api.github.com/users/ahti/followers","following_url":"https://api.github.com/users/ahti/following{/other_user}","gists_url":"https://api.github.com/users/ahti/gists{/gist_id}","starred_url":"https://api.github.com/users/ahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahti/subscriptions","organizations_url":"https://api.github.com/users/ahti/orgs","repos_url":"https://api.github.com/users/ahti/repos","events_url":"https://api.github.com/users/ahti/events{/privacy}","received_events_url":"https://api.github.com/users/ahti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ahti/sentry-swift","description":"","fork":true,"url":"https://api.github.com/repos/ahti/sentry-swift","forks_url":"https://api.github.com/repos/ahti/sentry-swift/forks","keys_url":"https://api.github.com/repos/ahti/sentry-swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahti/sentry-swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahti/sentry-swift/teams","hooks_url":"https://api.github.com/repos/ahti/sentry-swift/hooks","issue_events_url":"https://api.github.com/repos/ahti/sentry-swift/issues/events{/number}","events_url":"https://api.github.com/repos/ahti/sentry-swift/events","assignees_url":"https://api.github.com/repos/ahti/sentry-swift/assignees{/user}","branches_url":"https://api.github.com/repos/ahti/sentry-swift/branches{/branch}","tags_url":"https://api.github.com/repos/ahti/sentry-swift/tags","blobs_url":"https://api.github.com/repos/ahti/sentry-swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahti/sentry-swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahti/sentry-swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahti/sentry-swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahti/sentry-swift/statuses/{sha}","languages_url":"https://api.github.com/repos/ahti/sentry-swift/languages","stargazers_url":"https://api.github.com/repos/ahti/sentry-swift/stargazers","contributors_url":"https://api.github.com/repos/ahti/sentry-swift/contributors","subscribers_url":"https://api.github.com/repos/ahti/sentry-swift/subscribers","subscription_url":"https://api.github.com/repos/ahti/sentry-swift/subscription","commits_url":"https://api.github.com/repos/ahti/sentry-swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahti/sentry-swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahti/sentry-swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahti/sentry-swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahti/sentry-swift/contents/{+path}","compare_url":"https://api.github.com/repos/ahti/sentry-swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahti/sentry-swift/merges","archive_url":"https://api.github.com/repos/ahti/sentry-swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahti/sentry-swift/downloads","issues_url":"https://api.github.com/repos/ahti/sentry-swift/issues{/number}","pulls_url":"https://api.github.com/repos/ahti/sentry-swift/pulls{/number}","milestones_url":"https://api.github.com/repos/ahti/sentry-swift/milestones{/number}","notifications_url":"https://api.github.com/repos/ahti/sentry-swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahti/sentry-swift/labels{/name}","releases_url":"https://api.github.com/repos/ahti/sentry-swift/releases{/id}","deployments_url":"https://api.github.com/repos/ahti/sentry-swift/deployments","created_at":"2016-05-21T04:39:49Z","updated_at":"2016-05-21T04:39:50Z","pushed_at":"2016-07-21T08:06:39Z","git_url":"git://github.com/ahti/sentry-swift.git","ssh_url":"git@github.com:ahti/sentry-swift.git","clone_url":"https://github.com/ahti/sentry-swift.git","svn_url":"https://github.com/ahti/sentry-swift","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":"getsentry:master","ref":"master","sha":"bf8053160750287ceba926cdeb81bf7de348ab58","user":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"repo":{"id":55534429,"name":"sentry-swift","full_name":"getsentry/sentry-swift","owner":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getsentry/sentry-swift","description":"","fork":false,"url":"https://api.github.com/repos/getsentry/sentry-swift","forks_url":"https://api.github.com/repos/getsentry/sentry-swift/forks","keys_url":"https://api.github.com/repos/getsentry/sentry-swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getsentry/sentry-swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getsentry/sentry-swift/teams","hooks_url":"https://api.github.com/repos/getsentry/sentry-swift/hooks","issue_events_url":"https://api.github.com/repos/getsentry/sentry-swift/issues/events{/number}","events_url":"https://api.github.com/repos/getsentry/sentry-swift/events","assignees_url":"https://api.github.com/repos/getsentry/sentry-swift/assignees{/user}","branches_url":"https://api.github.com/repos/getsentry/sentry-swift/branches{/branch}","tags_url":"https://api.github.com/repos/getsentry/sentry-swift/tags","blobs_url":"https://api.github.com/repos/getsentry/sentry-swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getsentry/sentry-swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getsentry/sentry-swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/getsentry/sentry-swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getsentry/sentry-swift/statuses/{sha}","languages_url":"https://api.github.com/repos/getsentry/sentry-swift/languages","stargazers_url":"https://api.github.com/repos/getsentry/sentry-swift/stargazers","contributors_url":"https://api.github.com/repos/getsentry/sentry-swift/contributors","subscribers_url":"https://api.github.com/repos/getsentry/sentry-swift/subscribers","subscription_url":"https://api.github.com/repos/getsentry/sentry-swift/subscription","commits_url":"https://api.github.com/repos/getsentry/sentry-swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/getsentry/sentry-swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/getsentry/sentry-swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/getsentry/sentry-swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/getsentry/sentry-swift/contents/{+path}","compare_url":"https://api.github.com/repos/getsentry/sentry-swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getsentry/sentry-swift/merges","archive_url":"https://api.github.com/repos/getsentry/sentry-swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getsentry/sentry-swift/downloads","issues_url":"https://api.github.com/repos/getsentry/sentry-swift/issues{/number}","pulls_url":"https://api.github.com/repos/getsentry/sentry-swift/pulls{/number}","milestones_url":"https://api.github.com/repos/getsentry/sentry-swift/milestones{/number}","notifications_url":"https://api.github.com/repos/getsentry/sentry-swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getsentry/sentry-swift/labels{/name}","releases_url":"https://api.github.com/repos/getsentry/sentry-swift/releases{/id}","deployments_url":"https://api.github.com/repos/getsentry/sentry-swift/deployments","created_at":"2016-04-05T18:55:09Z","updated_at":"2016-07-15T20:21:09Z","pushed_at":"2016-07-21T19:34:05Z","git_url":"git://github.com/getsentry/sentry-swift.git","ssh_url":"git@github.com:getsentry/sentry-swift.git","clone_url":"https://github.com/getsentry/sentry-swift.git","svn_url":"https://github.com/getsentry/sentry-swift","homepage":null,"size":204,"stargazers_count":17,"watchers_count":17,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":8,"forks":7,"open_issues":8,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12"},"html":{"href":"https://github.com/getsentry/sentry-swift/pull/12"},"issue":{"href":"https://api.github.com/repos/getsentry/sentry-swift/issues/12"},"comments":{"href":"https://api.github.com/repos/getsentry/sentry-swift/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/getsentry/sentry-swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getsentry/sentry-swift/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/getsentry/sentry-swift/statuses/d69e9c0474a4a5003174769a848a7c151087ecde"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"joshdholtz","id":401294,"avatar_url":"https://avatars.githubusercontent.com/u/401294?v=3","gravatar_id":"","url":"https://api.github.com/users/joshdholtz","html_url":"https://github.com/joshdholtz","followers_url":"https://api.github.com/users/joshdholtz/followers","following_url":"https://api.github.com/users/joshdholtz/following{/other_user}","gists_url":"https://api.github.com/users/joshdholtz/gists{/gist_id}","starred_url":"https://api.github.com/users/joshdholtz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshdholtz/subscriptions","organizations_url":"https://api.github.com/users/joshdholtz/orgs","repos_url":"https://api.github.com/users/joshdholtz/repos","events_url":"https://api.github.com/users/joshdholtz/events{/privacy}","received_events_url":"https://api.github.com/users/joshdholtz/received_events","type":"User","site_admin":false},"comments":15,"review_comments":1,"commits":8,"additions":242,"deletions":2,"changed_files":8}}
{"actor":{"display_login":"joshdholtz"}}