Commit 552e9afa authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '211929-fix-handling-of-graphql-errors' into 'master'

Expect GraphQL errors to be an Array

Closes #211929

See merge request gitlab-org/gitlab!27685
parents c9a4c9af 4e2f8ef1
......@@ -138,7 +138,7 @@ export default {
variables: { id: this.snippet.id },
})
.then(({ data }) => {
if (data?.destroySnippet?.errors) {
if (data?.destroySnippet?.errors.length) {
throw new Error(data?.destroySnippet?.errors[0]);
}
this.isDeleting = false;
......
......@@ -32,7 +32,9 @@ describe('Snippet header component', () => {
const errorMsg = 'Foo bar';
const err = { message: errorMsg };
const resolveMutate = jest.fn(() => Promise.resolve({ data: {} }));
const resolveMutate = jest.fn(() =>
Promise.resolve({ data: { destroySnippet: { errors: [] } } }),
);
const rejectMutation = jest.fn(() => Promise.reject(err));
const mutationTypes = {
......
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