{"action":"created","comment":{"url":"https://api.github.com/repos/hapijs/joi/pulls/comments/32064596","id":32064596,"diff_hunk":"@@ -115,10 +115,16 @@ internals.root = function () {\n \n     root.assert = function (value, schema, message) {\n \n-        message = (message ? message + ' ' : '');\n         var error = root.validate(value, schema).error;\n         if (error) {\n-            throw new Error(message + error.annotate());\n+            if (!message) {\n+                message = new Error(error.annotate());","path":"lib/index.js","position":9,"original_position":9,"commit_id":"b536e2b660536ad8eb7f821099902dc689fd959a","original_commit_id":"b536e2b660536ad8eb7f821099902dc689fd959a","user":{"login":"Marsup","id":796194,"avatar_url":"https://avatars.githubusercontent.com/u/796194?v=3","gravatar_id":"","url":"https://api.github.com/users/Marsup","html_url":"https://github.com/Marsup","followers_url":"https://api.github.com/users/Marsup/followers","following_url":"https://api.github.com/users/Marsup/following{/other_user}","gists_url":"https://api.github.com/users/Marsup/gists{/gist_id}","starred_url":"https://api.github.com/users/Marsup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marsup/subscriptions","organizations_url":"https://api.github.com/users/Marsup/orgs","repos_url":"https://api.github.com/users/Marsup/repos","events_url":"https://api.github.com/users/Marsup/events{/privacy}","received_events_url":"https://api.github.com/users/Marsup/received_events","type":"User","site_admin":false},"body":"Don't bother re-assigning on both, just throw.","created_at":"2015-06-09T21:10:52Z","updated_at":"2015-06-09T21:10:52Z","html_url":"https://github.com/hapijs/joi/pull/668#discussion_r32064596","pull_request_url":"https://api.github.com/repos/hapijs/joi/pulls/668","_links":{"self":{"href":"https://api.github.com/repos/hapijs/joi/pulls/comments/32064596"},"html":{"href":"https://github.com/hapijs/joi/pull/668#discussion_r32064596"},"pull_request":{"href":"https://api.github.com/repos/hapijs/joi/pulls/668"}}},"pull_request":{"url":"https://api.github.com/repos/hapijs/joi/pulls/668","id":37280638,"html_url":"https://github.com/hapijs/joi/pull/668","diff_url":"https://github.com/hapijs/joi/pull/668.diff","patch_url":"https://github.com/hapijs/joi/pull/668.patch","issue_url":"https://api.github.com/repos/hapijs/joi/issues/668","number":668,"state":"open","locked":false,"title":"allow passing an error object as message to assert","user":{"login":"nlf","id":424045,"avatar_url":"https://avatars.githubusercontent.com/u/424045?v=3","gravatar_id":"","url":"https://api.github.com/users/nlf","html_url":"https://github.com/nlf","followers_url":"https://api.github.com/users/nlf/followers","following_url":"https://api.github.com/users/nlf/following{/other_user}","gists_url":"https://api.github.com/users/nlf/gists{/gist_id}","starred_url":"https://api.github.com/users/nlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlf/subscriptions","organizations_url":"https://api.github.com/users/nlf/orgs","repos_url":"https://api.github.com/users/nlf/repos","events_url":"https://api.github.com/users/nlf/events{/privacy}","received_events_url":"https://api.github.com/users/nlf/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-09T17:53:53Z","updated_at":"2015-06-09T21:10:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e159fd2d32bd72d0f7e68c8e1856da0259973b1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hapijs/joi/pulls/668/commits","review_comments_url":"https://api.github.com/repos/hapijs/joi/pulls/668/comments","review_comment_url":"https://api.github.com/repos/hapijs/joi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hapijs/joi/issues/668/comments","statuses_url":"https://api.github.com/repos/hapijs/joi/statuses/b536e2b660536ad8eb7f821099902dc689fd959a","head":{"label":"hapijs:assert_errors","ref":"assert_errors","sha":"b536e2b660536ad8eb7f821099902dc689fd959a","user":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"repo":{"id":5830987,"name":"joi","full_name":"hapijs/joi","owner":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hapijs/joi","description":"Object schema validation","fork":false,"url":"https://api.github.com/repos/hapijs/joi","forks_url":"https://api.github.com/repos/hapijs/joi/forks","keys_url":"https://api.github.com/repos/hapijs/joi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hapijs/joi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hapijs/joi/teams","hooks_url":"https://api.github.com/repos/hapijs/joi/hooks","issue_events_url":"https://api.github.com/repos/hapijs/joi/issues/events{/number}","events_url":"https://api.github.com/repos/hapijs/joi/events","assignees_url":"https://api.github.com/repos/hapijs/joi/assignees{/user}","branches_url":"https://api.github.com/repos/hapijs/joi/branches{/branch}","tags_url":"https://api.github.com/repos/hapijs/joi/tags","blobs_url":"https://api.github.com/repos/hapijs/joi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hapijs/joi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hapijs/joi/git/refs{/sha}","trees_url":"https://api.github.com/repos/hapijs/joi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hapijs/joi/statuses/{sha}","languages_url":"https://api.github.com/repos/hapijs/joi/languages","stargazers_url":"https://api.github.com/repos/hapijs/joi/stargazers","contributors_url":"https://api.github.com/repos/hapijs/joi/contributors","subscribers_url":"https://api.github.com/repos/hapijs/joi/subscribers","subscription_url":"https://api.github.com/repos/hapijs/joi/subscription","commits_url":"https://api.github.com/repos/hapijs/joi/commits{/sha}","git_commits_url":"https://api.github.com/repos/hapijs/joi/git/commits{/sha}","comments_url":"https://api.github.com/repos/hapijs/joi/comments{/number}","issue_comment_url":"https://api.github.com/repos/hapijs/joi/issues/comments{/number}","contents_url":"https://api.github.com/repos/hapijs/joi/contents/{+path}","compare_url":"https://api.github.com/repos/hapijs/joi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hapijs/joi/merges","archive_url":"https://api.github.com/repos/hapijs/joi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hapijs/joi/downloads","issues_url":"https://api.github.com/repos/hapijs/joi/issues{/number}","pulls_url":"https://api.github.com/repos/hapijs/joi/pulls{/number}","milestones_url":"https://api.github.com/repos/hapijs/joi/milestones{/number}","notifications_url":"https://api.github.com/repos/hapijs/joi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hapijs/joi/labels{/name}","releases_url":"https://api.github.com/repos/hapijs/joi/releases{/id}","created_at":"2012-09-16T16:38:06Z","updated_at":"2015-06-09T16:04:23Z","pushed_at":"2015-06-09T21:06:24Z","git_url":"git://github.com/hapijs/joi.git","ssh_url":"git@github.com:hapijs/joi.git","clone_url":"https://github.com/hapijs/joi.git","svn_url":"https://github.com/hapijs/joi","homepage":null,"size":4553,"stargazers_count":1307,"watchers_count":1307,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":165,"mirror_url":null,"open_issues_count":27,"forks":165,"open_issues":27,"watchers":1307,"default_branch":"master"}},"base":{"label":"hapijs:master","ref":"master","sha":"bb62f65b1b899727159917965982429a0bd750a7","user":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"repo":{"id":5830987,"name":"joi","full_name":"hapijs/joi","owner":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hapijs/joi","description":"Object schema validation","fork":false,"url":"https://api.github.com/repos/hapijs/joi","forks_url":"https://api.github.com/repos/hapijs/joi/forks","keys_url":"https://api.github.com/repos/hapijs/joi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hapijs/joi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hapijs/joi/teams","hooks_url":"https://api.github.com/repos/hapijs/joi/hooks","issue_events_url":"https://api.github.com/repos/hapijs/joi/issues/events{/number}","events_url":"https://api.github.com/repos/hapijs/joi/events","assignees_url":"https://api.github.com/repos/hapijs/joi/assignees{/user}","branches_url":"https://api.github.com/repos/hapijs/joi/branches{/branch}","tags_url":"https://api.github.com/repos/hapijs/joi/tags","blobs_url":"https://api.github.com/repos/hapijs/joi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hapijs/joi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hapijs/joi/git/refs{/sha}","trees_url":"https://api.github.com/repos/hapijs/joi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hapijs/joi/statuses/{sha}","languages_url":"https://api.github.com/repos/hapijs/joi/languages","stargazers_url":"https://api.github.com/repos/hapijs/joi/stargazers","contributors_url":"https://api.github.com/repos/hapijs/joi/contributors","subscribers_url":"https://api.github.com/repos/hapijs/joi/subscribers","subscription_url":"https://api.github.com/repos/hapijs/joi/subscription","commits_url":"https://api.github.com/repos/hapijs/joi/commits{/sha}","git_commits_url":"https://api.github.com/repos/hapijs/joi/git/commits{/sha}","comments_url":"https://api.github.com/repos/hapijs/joi/comments{/number}","issue_comment_url":"https://api.github.com/repos/hapijs/joi/issues/comments{/number}","contents_url":"https://api.github.com/repos/hapijs/joi/contents/{+path}","compare_url":"https://api.github.com/repos/hapijs/joi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hapijs/joi/merges","archive_url":"https://api.github.com/repos/hapijs/joi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hapijs/joi/downloads","issues_url":"https://api.github.com/repos/hapijs/joi/issues{/number}","pulls_url":"https://api.github.com/repos/hapijs/joi/pulls{/number}","milestones_url":"https://api.github.com/repos/hapijs/joi/milestones{/number}","notifications_url":"https://api.github.com/repos/hapijs/joi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hapijs/joi/labels{/name}","releases_url":"https://api.github.com/repos/hapijs/joi/releases{/id}","created_at":"2012-09-16T16:38:06Z","updated_at":"2015-06-09T16:04:23Z","pushed_at":"2015-06-09T21:06:24Z","git_url":"git://github.com/hapijs/joi.git","ssh_url":"git@github.com:hapijs/joi.git","clone_url":"https://github.com/hapijs/joi.git","svn_url":"https://github.com/hapijs/joi","homepage":null,"size":4553,"stargazers_count":1307,"watchers_count":1307,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":165,"mirror_url":null,"open_issues_count":27,"forks":165,"open_issues":27,"watchers":1307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hapijs/joi/pulls/668"},"html":{"href":"https://github.com/hapijs/joi/pull/668"},"issue":{"href":"https://api.github.com/repos/hapijs/joi/issues/668"},"comments":{"href":"https://api.github.com/repos/hapijs/joi/issues/668/comments"},"review_comments":{"href":"https://api.github.com/repos/hapijs/joi/pulls/668/comments"},"review_comment":{"href":"https://api.github.com/repos/hapijs/joi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hapijs/joi/pulls/668/commits"},"statuses":{"href":"https://api.github.com/repos/hapijs/joi/statuses/b536e2b660536ad8eb7f821099902dc689fd959a"}}}}