{"action":"created","comment":{"url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/comments/70340467","id":70340467,"diff_hunk":"@@ -7,7 +7,11 @@\n formatUsage = text => `\\`\\`\\`diff\\n${text}\\`\\`\\``\n \n formatError = msg => {\n-  const formattedText = `**Error:** ${msg.toString()}`  // prefix with bold 'Error:'\n-    .replace(/\\s\\-{1,2}[^\\s]+/, '`$&`')                   // show options preformatted\n-  return `${formattedText}. Try \\`--help\\` for usage.`  // append usage suggestion\n+  return msg.toString()\n+    // ensure prefixed with bold 'Error:'\n+    .replace(/(^Error: )?(.*)/, '**Error:** $2')\n+    // preformat commands or solo options\n+    .replace(/(\\W)((\\/\\w+)(\\s+\\-{1,2}[\\w_-]+)*|\\-{1,2}[\\w_-]+)/g, '$1`$2`')\n+    // make sure nothing got doubly-preformatted\n+    .replace(/``/g, '`')","path":"server/lib/format.js","position":13,"original_position":13,"commit_id":"c4078575e0834e76da4253349041bfbd028a00c2","original_commit_id":"c4078575e0834e76da4253349041bfbd028a00c2","user":{"login":"bundacia","id":189699,"avatar_url":"https://avatars.githubusercontent.com/u/189699?v=3","gravatar_id":"","url":"https://api.github.com/users/bundacia","html_url":"https://github.com/bundacia","followers_url":"https://api.github.com/users/bundacia/followers","following_url":"https://api.github.com/users/bundacia/following{/other_user}","gists_url":"https://api.github.com/users/bundacia/gists{/gist_id}","starred_url":"https://api.github.com/users/bundacia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bundacia/subscriptions","organizations_url":"https://api.github.com/users/bundacia/orgs","repos_url":"https://api.github.com/users/bundacia/repos","events_url":"https://api.github.com/users/bundacia/events{/privacy}","received_events_url":"https://api.github.com/users/bundacia/received_events","type":"User","site_admin":false},"body":"This is going to get false positives. For example, URL's:\r\n\r\n```\r\nformatError('click here: http://log.example.com/my-slug for more info')\r\n\"**Error:** click here: http:/`/log`.example.com/my-slug for more info\"\r\n```","created_at":"2016-07-11T21:27:15Z","updated_at":"2016-07-11T21:27:15Z","html_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44#discussion_r70340467","pull_request_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/comments/70340467"},"html":{"href":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44#discussion_r70340467"},"pull_request":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44","id":76853169,"html_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44","diff_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44.diff","patch_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44.patch","issue_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/44","number":44,"state":"open","locked":false,"title":"Fixes #42 -- better error formatting","user":{"login":"jeffreywescott","id":130597,"avatar_url":"https://avatars.githubusercontent.com/u/130597?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffreywescott","html_url":"https://github.com/jeffreywescott","followers_url":"https://api.github.com/users/jeffreywescott/followers","following_url":"https://api.github.com/users/jeffreywescott/following{/other_user}","gists_url":"https://api.github.com/users/jeffreywescott/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffreywescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffreywescott/subscriptions","organizations_url":"https://api.github.com/users/jeffreywescott/orgs","repos_url":"https://api.github.com/users/jeffreywescott/repos","events_url":"https://api.github.com/users/jeffreywescott/events{/privacy}","received_events_url":"https://api.github.com/users/jeffreywescott/received_events","type":"User","site_admin":false},"body":"- don't add the `try --help` phrase to the end of all errors\r\n- more robust pre-formatting for commands and options","created_at":"2016-07-09T18:06:43Z","updated_at":"2016-07-11T21:27:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88bec285350293bd700146400e153e9fce0edfd3","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/milestones/8","html_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/milestones/v0","labels_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/milestones/8/labels","id":1654133,"number":8,"title":"v0","description":null,"creator":{"login":"jeffreywescott","id":130597,"avatar_url":"https://avatars.githubusercontent.com/u/130597?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffreywescott","html_url":"https://github.com/jeffreywescott","followers_url":"https://api.github.com/users/jeffreywescott/followers","following_url":"https://api.github.com/users/jeffreywescott/following{/other_user}","gists_url":"https://api.github.com/users/jeffreywescott/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffreywescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffreywescott/subscriptions","organizations_url":"https://api.github.com/users/jeffreywescott/orgs","repos_url":"https://api.github.com/users/jeffreywescott/repos","events_url":"https://api.github.com/users/jeffreywescott/events{/privacy}","received_events_url":"https://api.github.com/users/jeffreywescott/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":5,"state":"open","created_at":"2016-03-18T18:24:08Z","updated_at":"2016-07-09T19:16:02Z","due_on":"2016-07-01T23:59:59Z","closed_at":null},"commits_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44/commits","review_comments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44/comments","review_comment_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/44/comments","statuses_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/statuses/c4078575e0834e76da4253349041bfbd028a00c2","head":{"label":"LearnersGuild:jw/42-better-error-formatting","ref":"jw/42-better-error-formatting","sha":"c4078575e0834e76da4253349041bfbd028a00c2","user":{"login":"LearnersGuild","id":14854339,"avatar_url":"https://avatars.githubusercontent.com/u/14854339?v=3","gravatar_id":"","url":"https://api.github.com/users/LearnersGuild","html_url":"https://github.com/LearnersGuild","followers_url":"https://api.github.com/users/LearnersGuild/followers","following_url":"https://api.github.com/users/LearnersGuild/following{/other_user}","gists_url":"https://api.github.com/users/LearnersGuild/gists{/gist_id}","starred_url":"https://api.github.com/users/LearnersGuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LearnersGuild/subscriptions","organizations_url":"https://api.github.com/users/LearnersGuild/orgs","repos_url":"https://api.github.com/users/LearnersGuild/repos","events_url":"https://api.github.com/users/LearnersGuild/events{/privacy}","received_events_url":"https://api.github.com/users/LearnersGuild/received_events","type":"Organization","site_admin":false},"repo":{"id":53869598,"name":"rocketchat-lg-slash-commands","full_name":"LearnersGuild/rocketchat-lg-slash-commands","owner":{"login":"LearnersGuild","id":14854339,"avatar_url":"https://avatars.githubusercontent.com/u/14854339?v=3","gravatar_id":"","url":"https://api.github.com/users/LearnersGuild","html_url":"https://github.com/LearnersGuild","followers_url":"https://api.github.com/users/LearnersGuild/followers","following_url":"https://api.github.com/users/LearnersGuild/following{/other_user}","gists_url":"https://api.github.com/users/LearnersGuild/gists{/gist_id}","starred_url":"https://api.github.com/users/LearnersGuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LearnersGuild/subscriptions","organizations_url":"https://api.github.com/users/LearnersGuild/orgs","repos_url":"https://api.github.com/users/LearnersGuild/repos","events_url":"https://api.github.com/users/LearnersGuild/events{/privacy}","received_events_url":"https://api.github.com/users/LearnersGuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands","description":"package to supply custom slash commands to Rocket.Chat for Learners Guild","fork":false,"url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands","forks_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/forks","keys_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/teams","hooks_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/hooks","issue_events_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/events{/number}","events_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/events","assignees_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/assignees{/user}","branches_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/branches{/branch}","tags_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/tags","blobs_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/refs{/sha}","trees_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/statuses/{sha}","languages_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/languages","stargazers_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/stargazers","contributors_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/contributors","subscribers_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/subscribers","subscription_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/subscription","commits_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/commits{/sha}","git_commits_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/commits{/sha}","comments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/comments{/number}","issue_comment_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/comments{/number}","contents_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/contents/{+path}","compare_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/merges","archive_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/downloads","issues_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues{/number}","pulls_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls{/number}","milestones_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/milestones{/number}","notifications_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/labels{/name}","releases_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/releases{/id}","deployments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/deployments","created_at":"2016-03-14T15:47:39Z","updated_at":"2016-04-01T01:43:01Z","pushed_at":"2016-07-10T18:39:01Z","git_url":"git://github.com/LearnersGuild/rocketchat-lg-slash-commands.git","ssh_url":"git@github.com:LearnersGuild/rocketchat-lg-slash-commands.git","clone_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands.git","svn_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands","homepage":null,"size":69,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"LearnersGuild:master","ref":"master","sha":"60e18ab3b715ea09b26a8795a47658217085e55d","user":{"login":"LearnersGuild","id":14854339,"avatar_url":"https://avatars.githubusercontent.com/u/14854339?v=3","gravatar_id":"","url":"https://api.github.com/users/LearnersGuild","html_url":"https://github.com/LearnersGuild","followers_url":"https://api.github.com/users/LearnersGuild/followers","following_url":"https://api.github.com/users/LearnersGuild/following{/other_user}","gists_url":"https://api.github.com/users/LearnersGuild/gists{/gist_id}","starred_url":"https://api.github.com/users/LearnersGuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LearnersGuild/subscriptions","organizations_url":"https://api.github.com/users/LearnersGuild/orgs","repos_url":"https://api.github.com/users/LearnersGuild/repos","events_url":"https://api.github.com/users/LearnersGuild/events{/privacy}","received_events_url":"https://api.github.com/users/LearnersGuild/received_events","type":"Organization","site_admin":false},"repo":{"id":53869598,"name":"rocketchat-lg-slash-commands","full_name":"LearnersGuild/rocketchat-lg-slash-commands","owner":{"login":"LearnersGuild","id":14854339,"avatar_url":"https://avatars.githubusercontent.com/u/14854339?v=3","gravatar_id":"","url":"https://api.github.com/users/LearnersGuild","html_url":"https://github.com/LearnersGuild","followers_url":"https://api.github.com/users/LearnersGuild/followers","following_url":"https://api.github.com/users/LearnersGuild/following{/other_user}","gists_url":"https://api.github.com/users/LearnersGuild/gists{/gist_id}","starred_url":"https://api.github.com/users/LearnersGuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LearnersGuild/subscriptions","organizations_url":"https://api.github.com/users/LearnersGuild/orgs","repos_url":"https://api.github.com/users/LearnersGuild/repos","events_url":"https://api.github.com/users/LearnersGuild/events{/privacy}","received_events_url":"https://api.github.com/users/LearnersGuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands","description":"package to supply custom slash commands to Rocket.Chat for Learners Guild","fork":false,"url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands","forks_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/forks","keys_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/teams","hooks_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/hooks","issue_events_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/events{/number}","events_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/events","assignees_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/assignees{/user}","branches_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/branches{/branch}","tags_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/tags","blobs_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/refs{/sha}","trees_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/statuses/{sha}","languages_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/languages","stargazers_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/stargazers","contributors_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/contributors","subscribers_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/subscribers","subscription_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/subscription","commits_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/commits{/sha}","git_commits_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/git/commits{/sha}","comments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/comments{/number}","issue_comment_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/comments{/number}","contents_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/contents/{+path}","compare_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/merges","archive_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/downloads","issues_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues{/number}","pulls_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls{/number}","milestones_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/milestones{/number}","notifications_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/labels{/name}","releases_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/releases{/id}","deployments_url":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/deployments","created_at":"2016-03-14T15:47:39Z","updated_at":"2016-04-01T01:43:01Z","pushed_at":"2016-07-10T18:39:01Z","git_url":"git://github.com/LearnersGuild/rocketchat-lg-slash-commands.git","ssh_url":"git@github.com:LearnersGuild/rocketchat-lg-slash-commands.git","clone_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands.git","svn_url":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands","homepage":null,"size":69,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44"},"html":{"href":"https://github.com/LearnersGuild/rocketchat-lg-slash-commands/pull/44"},"issue":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/44"},"comments":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/LearnersGuild/rocketchat-lg-slash-commands/statuses/c4078575e0834e76da4253349041bfbd028a00c2"}}}}
{"actor":{"display_login":"bundacia"}}