Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ui/public/index_patterns/__tests__/_index_pattern.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ jest.mock('../../saved_objects', () => {
update: async (type, id, body, { version }) => {
if (object._version !== version) {
throw {
statusCode: 409
res: {
status: 409
}
};
}

Expand Down Expand Up @@ -158,6 +160,6 @@ describe('IndexPattern', () => {
result = err;
}

expect(result.statusCode).toBe(409);
expect(result.res.status).toBe(409);
});
});
2 changes: 1 addition & 1 deletion src/ui/public/index_patterns/_index_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export function IndexPatternProvider(Private, config, Promise, confirmModalPromi
setVersion(this, _version);
})
.catch(err => {
if (err.statusCode === 409 && saveAttempts++ < MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS) {
if (_.get(err, 'res.status') === 409 && saveAttempts++ < MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS) {
const samePattern = new IndexPattern(this.id);
return samePattern.init()
.then(() => {
Expand Down