@@ -793,7 +793,15 @@ RestWrite.prototype.handleInstallation = function() {
793
793
if ( this . data . appIdentifier ) {
794
794
delQuery [ 'appIdentifier' ] = this . data . appIdentifier ;
795
795
}
796
- this . config . database . destroy ( '_Installation' , delQuery ) ;
796
+ this . config . database . destroy ( '_Installation' , delQuery )
797
+ . catch ( err => {
798
+ if ( err . code == Parse . Error . OBJECT_NOT_FOUND ) {
799
+ // no deletions were made. Can be ignored.
800
+ return ;
801
+ }
802
+ // rethrow the error
803
+ throw err ;
804
+ } ) ;
797
805
return ;
798
806
}
799
807
} else {
@@ -806,6 +814,14 @@ RestWrite.prototype.handleInstallation = function() {
806
814
return this . config . database . destroy ( '_Installation' , delQuery )
807
815
. then ( ( ) => {
808
816
return deviceTokenMatches [ 0 ] [ 'objectId' ] ;
817
+ } )
818
+ . catch ( err => {
819
+ if ( err . code == Parse . Error . OBJECT_NOT_FOUND ) {
820
+ // no deletions were made. Can be ignored
821
+ return ;
822
+ }
823
+ // rethrow the error
824
+ throw err ;
809
825
} ) ;
810
826
} else {
811
827
if ( this . data . deviceToken &&
@@ -835,7 +851,15 @@ RestWrite.prototype.handleInstallation = function() {
835
851
if ( this . data . appIdentifier ) {
836
852
delQuery [ 'appIdentifier' ] = this . data . appIdentifier ;
837
853
}
838
- this . config . database . destroy ( '_Installation' , delQuery ) ;
854
+ this . config . database . destroy ( '_Installation' , delQuery )
855
+ . catch ( err => {
856
+ if ( err . code == Parse . Error . OBJECT_NOT_FOUND ) {
857
+ // no deletions were made. Can be ignored.
858
+ return ;
859
+ }
860
+ // rethrow the error
861
+ throw err ;
862
+ } ) ;
839
863
}
840
864
// In non-merge scenarios, just return the installation match id
841
865
return idMatch . objectId ;
0 commit comments