diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2017-01-09 16:23:51 -0600 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-01-09 16:23:51 -0600 |
commit | e0e855b5f49bc8efc3ca69aa83ea28d6becb53cc (patch) | |
tree | da79b8812daefecd68f10a3692674c17e42ae421 | |
parent | c0287e69c6717fe9de5ff0b804f952410e453ef8 (diff) | |
download | gitlab-ce-e0e855b5f49bc8efc3ca69aa83ea28d6becb53cc.tar.gz |
Fix code review suggestions
-rw-r--r-- | app/assets/javascripts/droplab/droplab_ajax.js | 10 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js.es6 | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/droplab/droplab_ajax.js b/app/assets/javascripts/droplab/droplab_ajax.js index c8850f121d7..f20610b3811 100644 --- a/app/assets/javascripts/droplab/droplab_ajax.js +++ b/app/assets/javascripts/droplab/droplab_ajax.js @@ -3,6 +3,10 @@ /* global droplab */ require('../window')(function(w){ + function droplabAjaxException(message) { + this.message = message; + } + w.droplabAjax = { _loadUrlData: function _loadUrlData(url) { return new Promise(function(resolve, reject) { @@ -56,11 +60,7 @@ require('../window')(function(w){ } hook.list[config.method].call(hook.list, d); }).catch(function(e) { - if(e.message) { - console.error(e.message, e.stack); // eslint-disable-line no-console - } else { - console.error(e); // eslint-disable-line no-console - } + throw new droplabAjaxException(e.message || e); }); }, diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 8aa78f407e5..3e2c75d3cc6 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -169,6 +169,8 @@ w.gl.utils.getParameterByName = (name) => { const url = window.location.href; name = name.replace(/[[\]]/g, '\\$&'); + // Finds the value associated to the name + // Example, state=open where state is the name and open is the value const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`); const results = regex.exec(url); if (!results) return null; |