Commit f1acd505 authored by Fatih Acet's avatar Fatih Acet

Show error message from backend

parent 45eabf92
......@@ -250,8 +250,14 @@ export default {
if (error && error.name === 'SpamError') {
this.openRecaptcha();
} else {
let errMsg = `Error updating ${this.issuableType}`;
if (error && error.response && error.response.data && error.response.data.errors) {
errMsg = error.response.data.errors;
}
eventHub.$emit('close.form');
window.Flash(`Error updating ${this.issuableType}`);
window.Flash(errMsg);
}
});
},
......
......@@ -292,8 +292,8 @@ describe('Issuable output', () => {
it('shows error mesage from backend if exists', done => {
const msg = 'Custom error message from backend';
spyOn(vm.service, 'updateIssuable').and.callFake(() =>
Promise.reject({ response: { data: { errors: msg } } }), // eslint-disable-line prefer-promise-reject-errors
spyOn(vm.service, 'updateIssuable').and.callFake(
() => Promise.reject({ response: { data: { errors: msg } } }), // eslint-disable-line prefer-promise-reject-errors
);
vm.updateIssuable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment