{"action":"created","issue":{"url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/7","labels_url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/7/comments","events_url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/7/events","html_url":"https://github.com/genio/www-salesforce-nb/issues/7","id":108672123,"number":7,"title":"Errors for non-blocking","user":{"login":"genio","id":109551,"avatar_url":"https://avatars.githubusercontent.com/u/109551?v=3","gravatar_id":"","url":"https://api.github.com/users/genio","html_url":"https://github.com/genio","followers_url":"https://api.github.com/users/genio/followers","following_url":"https://api.github.com/users/genio/following{/other_user}","gists_url":"https://api.github.com/users/genio/gists{/gist_id}","starred_url":"https://api.github.com/users/genio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genio/subscriptions","organizations_url":"https://api.github.com/users/genio/orgs","repos_url":"https://api.github.com/users/genio/repos","events_url":"https://api.github.com/users/genio/events{/privacy}","received_events_url":"https://api.github.com/users/genio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-28T14:42:00Z","updated_at":"2015-10-01T02:12:55Z","closed_at":null,"body":"For non-blocking calls, erroring out ahead of time should be done via ```next_tick``` rather than calling ```$self->$cb('error_message',undef);``` directly.  ```$self``` should also be ```weaken```ed.\r\n\r\n```perl\r\nunless ($object) {\r\n  die 'An object is required to describe it' unless $cb;\r\n  $self->$cb('An object is required to describe it',undef);\r\n  return $self;\r\n}\r\n```\r\nvs.\r\n\r\n```perl\r\nunless ($object) {\r\n  die 'An object is required to describe it' unless $cb;\r\n  Scalar::Util::weaken $self;\r\n  Mojo::IOLoop->next_tick(sub { $self->$cb('An object is required to describe it') });\r\n  return $self;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/comments/144595065","html_url":"https://github.com/genio/www-salesforce-nb/issues/7#issuecomment-144595065","issue_url":"https://api.github.com/repos/genio/www-salesforce-nb/issues/7","id":144595065,"user":{"login":"genio","id":109551,"avatar_url":"https://avatars.githubusercontent.com/u/109551?v=3","gravatar_id":"","url":"https://api.github.com/users/genio","html_url":"https://github.com/genio","followers_url":"https://api.github.com/users/genio/followers","following_url":"https://api.github.com/users/genio/following{/other_user}","gists_url":"https://api.github.com/users/genio/gists{/gist_id}","starred_url":"https://api.github.com/users/genio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genio/subscriptions","organizations_url":"https://api.github.com/users/genio/orgs","repos_url":"https://api.github.com/users/genio/repos","events_url":"https://api.github.com/users/genio/events{/privacy}","received_events_url":"https://api.github.com/users/genio/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T02:12:55Z","updated_at":"2015-10-01T02:12:55Z","body":"No need to weaken since we aren't storing and using our own singleton.\r\n\r\n```perl\r\nunless ($object) {\r\n  die 'An object is required to describe it' unless $cb;\r\n  Mojo::IOLoop->next_tick(sub { $self->$cb('An object is required to describe it') });\r\n  return $self;\r\n}\r\n```\r\n"}}