{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/93089799","pull_request_review_id":13610646,"id":93089799,"diff_hunk":"@@ -455,112 +455,109 @@ class Sequelize {\n    *\n    * @see {@link Model#build} for more information about instance option.\n    */\n+\n   query(sql, options) {\n-    if (arguments.length > 2) {\n-      // TODO: Remove this note in the next major version (4.0)\n-      throw new Error('Sequelize.query was refactored to only use the parameters `sql` and `options`. Please read the changelog about BC.');\n-    }\n+    let bindParameters;\n \n-    options = _.assign({}, this.options.query, options);\n+    return Promise.try(() => {\n \n-    if (options.instance && !options.model) {\n-      options.model = options.instance.constructor;\n-    }\n+      options = _.assign({}, this.options.query, options);\n \n-    // Map raw fields to model field names using the `fieldAttributeMap`\n-    if (options.model && options.mapToModel && !Utils._.isEmpty(options.model.fieldAttributeMap)) {\n-      options.fieldMap =  options.model.fieldAttributeMap;\n-    }\n-\n-    if (typeof sql === 'object') {\n-      if (sql.values !== undefined) {\n-        if (options.replacements !== undefined) {\n-          throw new Error('Both `sql.values` and `options.replacements` cannot be set at the same time');\n-        }\n+      if (options.instance && !options.model) {\n+        options.model = options.instance.constructor;\n+      }\n \n-        options.replacements = sql.values;\n+      // Map raw fields to model field names using the `fieldAttributeMap`\n+      if (options.model && options.mapToModel && !Utils._.isEmpty(options.model.fieldAttributeMap)) {\n+        options.fieldMap =  options.model.fieldAttributeMap;\n       }\n \n-      if (sql.bind !== undefined) {\n-        if (options.bind !== undefined) {\n-          throw new Error('Both `sql.bind` and `options.bind` cannot be set at the same time');\n+      if (typeof sql === 'object') {\n+        if (sql.values !== undefined) {\n+          if (options.replacements !== undefined) {\n+            throw new Error('Both `sql.values` and `options.replacements` cannot be set at the same time');\n+          }\n+\n+          options.replacements = sql.values;\n         }\n \n-        options.bind = sql.bind;\n-      }\n+        if (sql.bind !== undefined) {\n+          if (options.bind !== undefined) {\n+            throw new Error('Both `sql.bind` and `options.bind` cannot be set at the same time');\n+          }\n \n-      if (sql.query !== undefined) {\n-        sql = sql.query;\n+          options.bind = sql.bind;\n+        }\n+\n+        if (sql.query !== undefined) {\n+          sql = sql.query;\n+        }\n       }\n-    }\n \n-    sql = sql.trim();\n+      sql = sql.trim();\n \n-    if (!options.instance && !options.model) {\n-      options.raw = true;\n-    }\n+      if (!options.instance && !options.model) {\n+        options.raw = true;\n+      }\n \n-    if (options.replacements && options.bind) {\n-      throw new Error('Both `replacements` and `bind` cannot be set at the same time');\n-    }\n-    if (options.replacements) {\n-      if (Array.isArray(options.replacements)) {\n-        sql = Utils.format([sql].concat(options.replacements), this.options.dialect);\n+      if (options.replacements && options.bind) {\n+        throw new Error('Both `replacements` and `bind` cannot be set at the same time');\n       }\n-      else {\n-        sql = Utils.formatNamedParameters(sql, options.replacements, this.options.dialect);\n+      if (options.replacements) {\n+        if (Array.isArray(options.replacements)) {\n+          sql = Utils.format([sql].concat(options.replacements), this.options.dialect);\n+        }\n+        else {","path":"lib/sequelize.js","position":95,"original_position":95,"commit_id":"b63c2c7dee8b503a7670e526919c8d98d83d2ef7","original_commit_id":"b63c2c7dee8b503a7670e526919c8d98d83d2ef7","user":{"login":"sushantdhiman","id":9989487,"avatar_url":"https://avatars.githubusercontent.com/u/9989487?v=3","gravatar_id":"","url":"https://api.github.com/users/sushantdhiman","html_url":"https://github.com/sushantdhiman","followers_url":"https://api.github.com/users/sushantdhiman/followers","following_url":"https://api.github.com/users/sushantdhiman/following{/other_user}","gists_url":"https://api.github.com/users/sushantdhiman/gists{/gist_id}","starred_url":"https://api.github.com/users/sushantdhiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushantdhiman/subscriptions","organizations_url":"https://api.github.com/users/sushantdhiman/orgs","repos_url":"https://api.github.com/users/sushantdhiman/repos","events_url":"https://api.github.com/users/sushantdhiman/events{/privacy}","received_events_url":"https://api.github.com/users/sushantdhiman/received_events","type":"User","site_admin":false},"body":"Balance `else` / parentheses to same level `} else {` ","created_at":"2016-12-19T18:26:24Z","updated_at":"2016-12-19T18:28:21Z","html_url":"https://github.com/sequelize/sequelize/pull/6999#discussion_r93089799","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/6999","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/93089799"},"html":{"href":"https://github.com/sequelize/sequelize/pull/6999#discussion_r93089799"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6999"}}},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/6999","id":98436697,"html_url":"https://github.com/sequelize/sequelize/pull/6999","diff_url":"https://github.com/sequelize/sequelize/pull/6999.diff","patch_url":"https://github.com/sequelize/sequelize/pull/6999.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/6999","number":6999,"state":"open","locked":false,"title":"try catch block added for formatting parameters process","user":{"login":"abdulmoizeng","id":7362484,"avatar_url":"https://avatars.githubusercontent.com/u/7362484?v=3","gravatar_id":"","url":"https://api.github.com/users/abdulmoizeng","html_url":"https://github.com/abdulmoizeng","followers_url":"https://api.github.com/users/abdulmoizeng/followers","following_url":"https://api.github.com/users/abdulmoizeng/following{/other_user}","gists_url":"https://api.github.com/users/abdulmoizeng/gists{/gist_id}","starred_url":"https://api.github.com/users/abdulmoizeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abdulmoizeng/subscriptions","organizations_url":"https://api.github.com/users/abdulmoizeng/orgs","repos_url":"https://api.github.com/users/abdulmoizeng/repos","events_url":"https://api.github.com/users/abdulmoizeng/events{/privacy}","received_events_url":"https://api.github.com/users/abdulmoizeng/received_events","type":"User","site_admin":false},"body":"### Description of change\r\nsequelize not rejects promise if 'formatNamedParameters' throws an error\r\n","created_at":"2016-12-17T07:36:59Z","updated_at":"2016-12-19T18:28:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfd84d86688306ee05188606a29ead72cb4e23ac","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/6999/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/6999/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/6999/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/b63c2c7dee8b503a7670e526919c8d98d83d2ef7","head":{"label":"abdulmoizeng:master","ref":"master","sha":"b63c2c7dee8b503a7670e526919c8d98d83d2ef7","user":{"login":"abdulmoizeng","id":7362484,"avatar_url":"https://avatars.githubusercontent.com/u/7362484?v=3","gravatar_id":"","url":"https://api.github.com/users/abdulmoizeng","html_url":"https://github.com/abdulmoizeng","followers_url":"https://api.github.com/users/abdulmoizeng/followers","following_url":"https://api.github.com/users/abdulmoizeng/following{/other_user}","gists_url":"https://api.github.com/users/abdulmoizeng/gists{/gist_id}","starred_url":"https://api.github.com/users/abdulmoizeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abdulmoizeng/subscriptions","organizations_url":"https://api.github.com/users/abdulmoizeng/orgs","repos_url":"https://api.github.com/users/abdulmoizeng/repos","events_url":"https://api.github.com/users/abdulmoizeng/events{/privacy}","received_events_url":"https://api.github.com/users/abdulmoizeng/received_events","type":"User","site_admin":false},"repo":{"id":76709860,"name":"sequelize","full_name":"abdulmoizeng/sequelize","owner":{"login":"abdulmoizeng","id":7362484,"avatar_url":"https://avatars.githubusercontent.com/u/7362484?v=3","gravatar_id":"","url":"https://api.github.com/users/abdulmoizeng","html_url":"https://github.com/abdulmoizeng","followers_url":"https://api.github.com/users/abdulmoizeng/followers","following_url":"https://api.github.com/users/abdulmoizeng/following{/other_user}","gists_url":"https://api.github.com/users/abdulmoizeng/gists{/gist_id}","starred_url":"https://api.github.com/users/abdulmoizeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abdulmoizeng/subscriptions","organizations_url":"https://api.github.com/users/abdulmoizeng/orgs","repos_url":"https://api.github.com/users/abdulmoizeng/repos","events_url":"https://api.github.com/users/abdulmoizeng/events{/privacy}","received_events_url":"https://api.github.com/users/abdulmoizeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abdulmoizeng/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/abdulmoizeng/sequelize","forks_url":"https://api.github.com/repos/abdulmoizeng/sequelize/forks","keys_url":"https://api.github.com/repos/abdulmoizeng/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abdulmoizeng/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abdulmoizeng/sequelize/teams","hooks_url":"https://api.github.com/repos/abdulmoizeng/sequelize/hooks","issue_events_url":"https://api.github.com/repos/abdulmoizeng/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/abdulmoizeng/sequelize/events","assignees_url":"https://api.github.com/repos/abdulmoizeng/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/abdulmoizeng/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/abdulmoizeng/sequelize/tags","blobs_url":"https://api.github.com/repos/abdulmoizeng/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abdulmoizeng/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abdulmoizeng/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/abdulmoizeng/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abdulmoizeng/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/abdulmoizeng/sequelize/languages","stargazers_url":"https://api.github.com/repos/abdulmoizeng/sequelize/stargazers","contributors_url":"https://api.github.com/repos/abdulmoizeng/sequelize/contributors","subscribers_url":"https://api.github.com/repos/abdulmoizeng/sequelize/subscribers","subscription_url":"https://api.github.com/repos/abdulmoizeng/sequelize/subscription","commits_url":"https://api.github.com/repos/abdulmoizeng/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/abdulmoizeng/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/abdulmoizeng/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/abdulmoizeng/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/abdulmoizeng/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/abdulmoizeng/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abdulmoizeng/sequelize/merges","archive_url":"https://api.github.com/repos/abdulmoizeng/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abdulmoizeng/sequelize/downloads","issues_url":"https://api.github.com/repos/abdulmoizeng/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/abdulmoizeng/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/abdulmoizeng/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/abdulmoizeng/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abdulmoizeng/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/abdulmoizeng/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/abdulmoizeng/sequelize/deployments","created_at":"2016-12-17T07:17:17Z","updated_at":"2016-12-17T07:17:23Z","pushed_at":"2016-12-19T07:17:25Z","git_url":"git://github.com/abdulmoizeng/sequelize.git","ssh_url":"git@github.com:abdulmoizeng/sequelize.git","clone_url":"https://github.com/abdulmoizeng/sequelize.git","svn_url":"https://github.com/abdulmoizeng/sequelize","homepage":"http://sequelizejs.com","size":19015,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"sequelize:master","ref":"master","sha":"cc09a3c7137c8668dbb5b33fea7ab47fa0feeb2f","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"name":"sequelize","full_name":"sequelize/sequelize","owner":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sequelize/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2016-12-19T17:10:27Z","pushed_at":"2016-12-19T07:17:28Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://sequelizejs.com","size":18929,"stargazers_count":8294,"watchers_count":8294,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1640,"mirror_url":null,"open_issues_count":766,"forks":1640,"open_issues":766,"watchers":8294,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6999"},"html":{"href":"https://github.com/sequelize/sequelize/pull/6999"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/6999"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/6999/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6999/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6999/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/b63c2c7dee8b503a7670e526919c8d98d83d2ef7"}}}}
{"actor":{"display_login":"sushantdhiman"}}