summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/task_list.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-02-02 12:36:51 +0000
committerPhil Hughes <me@iamphill.com>2018-02-05 09:41:44 +0000
commit004158066de3442d63293b947c2f705032903342 (patch)
treeeedfc49aae8f33714b08b3587a15b4a3b11973ec /app/assets/javascripts/task_list.js
parent8d83e517a98688d453baffed17dc000b6b23ef23 (diff)
downloadgitlab-ce-004158066de3442d63293b947c2f705032903342.tar.gz
fixed failing karma specs caused by TaskList
Diffstat (limited to 'app/assets/javascripts/task_list.js')
-rw-r--r--app/assets/javascripts/task_list.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js
index c35a702ecfc..129a551cbcd 100644
--- a/app/assets/javascripts/task_list.js
+++ b/app/assets/javascripts/task_list.js
@@ -8,11 +8,11 @@ export default class TaskList {
this.dataType = options.dataType;
this.fieldName = options.fieldName;
this.onSuccess = options.onSuccess || (() => {});
- this.onError = function showFlash(response) {
+ this.onError = function showFlash(e) {
let errorMessages = '';
- if (response.responseJSON) {
- errorMessages = response.responseJSON.errors.join(' ');
+ if (e.response.data && typeof e.response.data === 'object') {
+ errorMessages = e.response.data.errors.join(' ');
}
return new Flash(errorMessages || 'Update failed', 'alert');
@@ -42,6 +42,6 @@ export default class TaskList {
return axios.patch($target.data('update-url') || $('form.js-issuable-update').attr('action'), patchData)
.then(({ data }) => this.onSuccess(data))
- .catch(() => this.onError());
+ .catch(err => this.onError(err));
}
}