From 003837b012d7156cc9af91cc89ae0a233906d6fe Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Wed, 27 Sep 2023 19:36:56 -0500 Subject: [PATCH] fix: Properly handle connection failure in `saveEventually` and `destroyEventually` --- src/ParseObject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ParseObject.js b/src/ParseObject.js index 94c30b9c1..bbbc4e1a3 100644 --- a/src/ParseObject.js +++ b/src/ParseObject.js @@ -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(); } @@ -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(); }