Explorar el Código

Properly report push promise rejections (#682)

Danilo Bargen hace 6 años
padre
commit
3b720c12c2
Se han modificado 2 ficheros con 4 adiciones y 2 borrados
  1. 2 0
      src/services/push.ts
  2. 2 2
      src/services/webclient.ts

+ 2 - 0
src/services/push.ts

@@ -72,6 +72,8 @@ export class PushService {
     /**
      * Send a push notification for the specified session (public permanent key
      * of the initiator). The promise is always resolved to a boolean.
+     *
+     * If something goes wrong, the promise is rejected with an `Error` instance.
      */
     public async sendPush(session: Uint8Array): Promise<boolean> {
         if (!this.isAvailable()) {

+ 2 - 2
src/services/webclient.ts

@@ -1022,13 +1022,13 @@ export class WebClientService {
 
         // Actually send the push notification
         this.pushService.sendPush(this.salty.permanentKeyBytes)
-            .catch(() => this.$log.warn(this.logTag, 'Could not notify app!'))
             .then(() => {
                 this.$log.debug(this.logTag, 'Requested app wakeup via', this.pushTokenType, 'push');
                 this.$rootScope.$apply(() => {
                     this.stateService.updateConnectionBuildupState('push');
                 });
-            });
+            })
+            .catch((e: Error) => this.$log.error(this.logTag, 'Could not send wakeup push to app: ' + e.message));
     }
 
     /**