{"action":"created","comment":{"url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/comments/34147643","id":34147643,"diff_hunk":"@@ -70,14 +70,25 @@ module.exports = (function() {\n         };\n \n         self.raiseEvents = function (eventId, event, options, afterRaised) {\n-            _stats.queuedEventsToRaise++;\n-            if (options instanceof Function) {\n+            if(options instanceof Function && afterRaised)\n+                throw new Error('the third argument must be an object when a fourth argument is provided.');\n+\n+            if (options instanceof Function && !afterRaised) {\n                 afterRaised = options;\n                 options = null;\n             }\n \n-            var eventData = self.encoder.encodeEvent(event);\n-            publishOrQueue(config.exchange, eventId, eventData, options, afterRaised);\n+            if(!(afterRaised instanceof Function))\n+                throw new Error('the argument provided for callback is not a Function');\n+\n+            if(typeof eventId !== 'string') {\n+                afterRaised(new Error('eventId is required and must be a string'));","path":"src/busterbunny.js","position":20,"original_position":20,"commit_id":"9595a3ab68b5122fc2ba9a707c5652338b59a16c","original_commit_id":"9595a3ab68b5122fc2ba9a707c5652338b59a16c","user":{"login":"jhaugh42","id":2278041,"avatar_url":"https://avatars.githubusercontent.com/u/2278041?v=3","gravatar_id":"","url":"https://api.github.com/users/jhaugh42","html_url":"https://github.com/jhaugh42","followers_url":"https://api.github.com/users/jhaugh42/followers","following_url":"https://api.github.com/users/jhaugh42/following{/other_user}","gists_url":"https://api.github.com/users/jhaugh42/gists{/gist_id}","starred_url":"https://api.github.com/users/jhaugh42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhaugh42/subscriptions","organizations_url":"https://api.github.com/users/jhaugh42/orgs","repos_url":"https://api.github.com/users/jhaugh42/repos","events_url":"https://api.github.com/users/jhaugh42/events{/privacy}","received_events_url":"https://api.github.com/users/jhaugh42/received_events","type":"User","site_admin":false},"body":"Good point.  This choice was predicated that for any error returned by the framework (assuming a callback is provided) the callback should be called with the error.  The steps ahead of this ensure that we can at least call back with an error.  We should seek @binaryalchemist's opinion.","created_at":"2015-07-08T13:39:35Z","updated_at":"2015-07-08T13:39:35Z","html_url":"https://github.com/GannettDigital/busterbunny.js/pull/7#discussion_r34147643","pull_request_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/comments/34147643"},"html":{"href":"https://github.com/GannettDigital/busterbunny.js/pull/7#discussion_r34147643"},"pull_request":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7","id":39425561,"html_url":"https://github.com/GannettDigital/busterbunny.js/pull/7","diff_url":"https://github.com/GannettDigital/busterbunny.js/pull/7.diff","patch_url":"https://github.com/GannettDigital/busterbunny.js/pull/7.patch","issue_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/7","number":7,"state":"open","locked":false,"title":"ISSUE-5 - Adding validation to raiseEvents","user":{"login":"jhaugh42","id":2278041,"avatar_url":"https://avatars.githubusercontent.com/u/2278041?v=3","gravatar_id":"","url":"https://api.github.com/users/jhaugh42","html_url":"https://github.com/jhaugh42","followers_url":"https://api.github.com/users/jhaugh42/followers","following_url":"https://api.github.com/users/jhaugh42/following{/other_user}","gists_url":"https://api.github.com/users/jhaugh42/gists{/gist_id}","starred_url":"https://api.github.com/users/jhaugh42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhaugh42/subscriptions","organizations_url":"https://api.github.com/users/jhaugh42/orgs","repos_url":"https://api.github.com/users/jhaugh42/repos","events_url":"https://api.github.com/users/jhaugh42/events{/privacy}","received_events_url":"https://api.github.com/users/jhaugh42/received_events","type":"User","site_admin":false},"body":"`eventId` is required to be a string.\r\n`options || afterRaised` must be a function","created_at":"2015-07-07T22:51:58Z","updated_at":"2015-07-08T13:39:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b885d412bfbeea520ced08f593f52710b7f53967","assignee":{"login":"enigmatic00","id":89329,"avatar_url":"https://avatars.githubusercontent.com/u/89329?v=3","gravatar_id":"","url":"https://api.github.com/users/enigmatic00","html_url":"https://github.com/enigmatic00","followers_url":"https://api.github.com/users/enigmatic00/followers","following_url":"https://api.github.com/users/enigmatic00/following{/other_user}","gists_url":"https://api.github.com/users/enigmatic00/gists{/gist_id}","starred_url":"https://api.github.com/users/enigmatic00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enigmatic00/subscriptions","organizations_url":"https://api.github.com/users/enigmatic00/orgs","repos_url":"https://api.github.com/users/enigmatic00/repos","events_url":"https://api.github.com/users/enigmatic00/events{/privacy}","received_events_url":"https://api.github.com/users/enigmatic00/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7/commits","review_comments_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7/comments","review_comment_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/7/comments","statuses_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/statuses/9595a3ab68b5122fc2ba9a707c5652338b59a16c","head":{"label":"GannettDigital:ISSUE-5","ref":"ISSUE-5","sha":"9595a3ab68b5122fc2ba9a707c5652338b59a16c","user":{"login":"GannettDigital","id":1149177,"avatar_url":"https://avatars.githubusercontent.com/u/1149177?v=3","gravatar_id":"","url":"https://api.github.com/users/GannettDigital","html_url":"https://github.com/GannettDigital","followers_url":"https://api.github.com/users/GannettDigital/followers","following_url":"https://api.github.com/users/GannettDigital/following{/other_user}","gists_url":"https://api.github.com/users/GannettDigital/gists{/gist_id}","starred_url":"https://api.github.com/users/GannettDigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GannettDigital/subscriptions","organizations_url":"https://api.github.com/users/GannettDigital/orgs","repos_url":"https://api.github.com/users/GannettDigital/repos","events_url":"https://api.github.com/users/GannettDigital/events{/privacy}","received_events_url":"https://api.github.com/users/GannettDigital/received_events","type":"Organization","site_admin":false},"repo":{"id":35832331,"name":"busterbunny.js","full_name":"GannettDigital/busterbunny.js","owner":{"login":"GannettDigital","id":1149177,"avatar_url":"https://avatars.githubusercontent.com/u/1149177?v=3","gravatar_id":"","url":"https://api.github.com/users/GannettDigital","html_url":"https://github.com/GannettDigital","followers_url":"https://api.github.com/users/GannettDigital/followers","following_url":"https://api.github.com/users/GannettDigital/following{/other_user}","gists_url":"https://api.github.com/users/GannettDigital/gists{/gist_id}","starred_url":"https://api.github.com/users/GannettDigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GannettDigital/subscriptions","organizations_url":"https://api.github.com/users/GannettDigital/orgs","repos_url":"https://api.github.com/users/GannettDigital/repos","events_url":"https://api.github.com/users/GannettDigital/events{/privacy}","received_events_url":"https://api.github.com/users/GannettDigital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GannettDigital/busterbunny.js","description":"Opinionated EventBus Library for amqplib","fork":false,"url":"https://api.github.com/repos/GannettDigital/busterbunny.js","forks_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/forks","keys_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/teams","hooks_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/hooks","issue_events_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/events{/number}","events_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/events","assignees_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/assignees{/user}","branches_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/branches{/branch}","tags_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/tags","blobs_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/statuses/{sha}","languages_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/languages","stargazers_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/stargazers","contributors_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/contributors","subscribers_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/subscribers","subscription_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/subscription","commits_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/contents/{+path}","compare_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/merges","archive_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/downloads","issues_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues{/number}","pulls_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls{/number}","milestones_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/milestones{/number}","notifications_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/labels{/name}","releases_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/releases{/id}","created_at":"2015-05-18T17:33:40Z","updated_at":"2015-06-01T17:18:49Z","pushed_at":"2015-07-08T12:01:05Z","git_url":"git://github.com/GannettDigital/busterbunny.js.git","ssh_url":"git@github.com:GannettDigital/busterbunny.js.git","clone_url":"https://github.com/GannettDigital/busterbunny.js.git","svn_url":"https://github.com/GannettDigital/busterbunny.js","homepage":"","size":216,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"GannettDigital:master","ref":"master","sha":"d192ef5035bd5d7c1dc4a95998a5c4f663002fdf","user":{"login":"GannettDigital","id":1149177,"avatar_url":"https://avatars.githubusercontent.com/u/1149177?v=3","gravatar_id":"","url":"https://api.github.com/users/GannettDigital","html_url":"https://github.com/GannettDigital","followers_url":"https://api.github.com/users/GannettDigital/followers","following_url":"https://api.github.com/users/GannettDigital/following{/other_user}","gists_url":"https://api.github.com/users/GannettDigital/gists{/gist_id}","starred_url":"https://api.github.com/users/GannettDigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GannettDigital/subscriptions","organizations_url":"https://api.github.com/users/GannettDigital/orgs","repos_url":"https://api.github.com/users/GannettDigital/repos","events_url":"https://api.github.com/users/GannettDigital/events{/privacy}","received_events_url":"https://api.github.com/users/GannettDigital/received_events","type":"Organization","site_admin":false},"repo":{"id":35832331,"name":"busterbunny.js","full_name":"GannettDigital/busterbunny.js","owner":{"login":"GannettDigital","id":1149177,"avatar_url":"https://avatars.githubusercontent.com/u/1149177?v=3","gravatar_id":"","url":"https://api.github.com/users/GannettDigital","html_url":"https://github.com/GannettDigital","followers_url":"https://api.github.com/users/GannettDigital/followers","following_url":"https://api.github.com/users/GannettDigital/following{/other_user}","gists_url":"https://api.github.com/users/GannettDigital/gists{/gist_id}","starred_url":"https://api.github.com/users/GannettDigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GannettDigital/subscriptions","organizations_url":"https://api.github.com/users/GannettDigital/orgs","repos_url":"https://api.github.com/users/GannettDigital/repos","events_url":"https://api.github.com/users/GannettDigital/events{/privacy}","received_events_url":"https://api.github.com/users/GannettDigital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GannettDigital/busterbunny.js","description":"Opinionated EventBus Library for amqplib","fork":false,"url":"https://api.github.com/repos/GannettDigital/busterbunny.js","forks_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/forks","keys_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/teams","hooks_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/hooks","issue_events_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/events{/number}","events_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/events","assignees_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/assignees{/user}","branches_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/branches{/branch}","tags_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/tags","blobs_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/statuses/{sha}","languages_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/languages","stargazers_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/stargazers","contributors_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/contributors","subscribers_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/subscribers","subscription_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/subscription","commits_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/contents/{+path}","compare_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/merges","archive_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/downloads","issues_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues{/number}","pulls_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls{/number}","milestones_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/milestones{/number}","notifications_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/labels{/name}","releases_url":"https://api.github.com/repos/GannettDigital/busterbunny.js/releases{/id}","created_at":"2015-05-18T17:33:40Z","updated_at":"2015-06-01T17:18:49Z","pushed_at":"2015-07-08T12:01:05Z","git_url":"git://github.com/GannettDigital/busterbunny.js.git","ssh_url":"git@github.com:GannettDigital/busterbunny.js.git","clone_url":"https://github.com/GannettDigital/busterbunny.js.git","svn_url":"https://github.com/GannettDigital/busterbunny.js","homepage":"","size":216,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7"},"html":{"href":"https://github.com/GannettDigital/busterbunny.js/pull/7"},"issue":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/7"},"comments":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/GannettDigital/busterbunny.js/statuses/9595a3ab68b5122fc2ba9a707c5652338b59a16c"}}}}