Quellcode durchsuchen

If contact has missing feature, log details (#978)

This can help us when debugging related bugs.
Danilo Bargen vor 5 Jahren
Ursprung
Commit
db2e400f2c
2 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen
  1. 5 3
      src/helpers.ts
  2. 4 0
      src/services/webclient.ts

+ 5 - 3
src/helpers.ts

@@ -256,9 +256,11 @@ export function msgpackVisualizer(array: Uint8Array): string {
 /**
  * Check the featureMask of a contactReceiver
  */
-export function hasFeature(contactReceiver: threema.ContactReceiver,
-                           feature: threema.ContactReceiverFeature,
-                           log: Logger): boolean {
+export function hasFeature(
+    contactReceiver: threema.ContactReceiver,
+    feature: threema.ContactReceiverFeature,
+    log: Logger,
+): boolean {
     if (contactReceiver !== undefined) {
         if (contactReceiver.featureMask === 0) {
             log.warn(`Contact receiver with id ${contactReceiver.id} has featureMask 0`);

+ 4 - 0
src/services/webclient.ts

@@ -1863,6 +1863,10 @@ export class WebClientService {
                                     // an error message.
                                     this.log.error(`Cannot retrieve contact ${identity}`);
                                 } else if (!hasFeature(contact, requiredFeature, this.log)) {
+                                    this.log.warn(
+                                        `Contact ${identity} has feature masks ${contact.featureMask} ` +
+                                        `which does not include ${requiredFeature}`
+                                    );
                                     unsupportedMembers.push(contact.displayName);
                                 }
                             }