Skip to content

Commit

Permalink
fix: Properly handle connection failure in saveEventually and `dest…
Browse files Browse the repository at this point in the history
…royEventually`
  • Loading branch information
dplewis committed Sep 28, 2023
1 parent e0b713e commit 003837b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ParseObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ class ParseObject {
try {
await this.save(null, options);
} catch (e) {
if (e.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
if (e.code === ParseError.CONNECTION_FAILED) {
await EventuallyQueue.save(this, options);
EventuallyQueue.poll();
}
Expand Down Expand Up @@ -1363,7 +1363,7 @@ class ParseObject {
try {
await this.destroy(options);
} catch (e) {
if (e.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
if (e.code === ParseError.CONNECTION_FAILED) {
await EventuallyQueue.destroy(this, options);
EventuallyQueue.poll();
}
Expand Down

0 comments on commit 003837b

Please sign in to comment.