@@ -90,7 +90,7 @@ class PingUploader implements PingsDatabaseObserver {
9090 this . queue = [ ] ;
9191 this . status = PingUploaderStatus . Idle ;
9292 // Initialize the ping uploader with either the platform defaults or a custom
93- // provided uploader from the configuration object.npm
93+ // provided uploader from the configuration object.
9494 this . uploader = config . httpClient ? config . httpClient : platform . uploader ;
9595 this . platformInfo = platform . info ;
9696 this . serverEndpoint = config . serverEndpoint ;
@@ -251,16 +251,17 @@ class PingUploader implements PingsDatabaseObserver {
251251 * @returns Whether or not to retry the upload attempt.
252252 */
253253 private async processPingUploadResponse ( identifier : string , response : UploadResult ) : Promise < boolean > {
254- if ( response . status && response . status >= 200 && response . status < 300 ) {
255- log ( LOG_TAG , `Ping ${ identifier } succesfully sent ${ response . status } .` , LoggingLevel . Info ) ;
254+ const { status, result } = response ;
255+ if ( status && status >= 200 && status < 300 ) {
256+ log ( LOG_TAG , `Ping ${ identifier } succesfully sent ${ status } .` , LoggingLevel . Info ) ;
256257 await this . pingsDatabase . deletePing ( identifier ) ;
257258 return false ;
258259 }
259260
260- if ( response . result === UploadResultStatus . UnrecoverableFailure || ( response . status && response . status >= 400 && response . status < 500 ) ) {
261+ if ( result === UploadResultStatus . UnrecoverableFailure || ( status && status >= 400 && status < 500 ) ) {
261262 log (
262263 LOG_TAG ,
263- `Unrecoverable upload failure while attempting to send ping ${ identifier } . Error was: ${ response . status ?? "no status" } .` ,
264+ `Unrecoverable upload failure while attempting to send ping ${ identifier } . Error was: ${ status ?? "no status" } .` ,
264265 LoggingLevel . Warn
265266 ) ;
266267 await this . pingsDatabase . deletePing ( identifier ) ;
@@ -271,7 +272,7 @@ class PingUploader implements PingsDatabaseObserver {
271272 LOG_TAG ,
272273 [
273274 `Recoverable upload failure while attempting to send ping ${ identifier } , will retry.` ,
274- `Error was ${ response . status ?? "no status" } .`
275+ `Error was ${ status ?? "no status" } .`
275276 ] ,
276277 LoggingLevel . Warn
277278 ) ;
0 commit comments