Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Catch error 500 on delete #848

Merged
merged 2 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions src/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ function syncKinto(client, credentials) {
.sync({
headers: {Authorization: `Bearer ${credential.access_token}`},
strategy: 'manual',
})
.catch((error) => {
if (error.response && error.response.status === 500) {
// issue #827
return Promise.resolve({
conflicts: []
});
}

throw error;
});
});
})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('Authorization', function() {
.then(() => {
// Verify that the notes collection was deleted.
console.log(JSON.stringify(fetchMock.calls()));
chai.assert(deleted);
chai.assert(deleted, 'was deleted');
return collection.getAny('singleNote');
}).then(result => {
// Record now needs to be synced again.
Expand Down