Skip to content

Commit a7f7fae

Browse files
authored
Merge pull request doccano#418 from liamcripwell/feature/label_nonfield_error_messages
Feature/label nonfield error messages
2 parents 9049a6b + a1c9f6a commit a7f7fae

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/server/static/components/label.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,13 @@ export default {
264264
})
265265
.catch((error) => {
266266
console.log(error); // eslint-disable-line no-console
267-
this.messages.push('You cannot use same label name or shortcut key.');
267+
if (error.response.data.non_field_errors) {
268+
error.response.data.non_field_errors.forEach((msg) => {
269+
this.messages.push(msg);
270+
});
271+
} else {
272+
this.messages.push('You cannot use same label name or shortcut key.');
273+
}
268274
});
269275
},
270276
@@ -312,7 +318,13 @@ export default {
312318
})
313319
.catch((error) => {
314320
console.log(error); // eslint-disable-line no-console
315-
this.messages.push('You cannot use same label name or shortcut key.');
321+
if (error.response.data.non_field_errors) {
322+
error.response.data.non_field_errors.forEach((msg) => {
323+
this.messages.push(msg);
324+
});
325+
} else {
326+
this.messages.push('You cannot use same label name or shortcut key.');
327+
}
316328
});
317329
},
318330

0 commit comments

Comments
 (0)