FirebaseArrayIndexError interface

النوع المركب الذي يتضمن كائن FirebaseError وفهرسًا يمكن استخدامه للحصول على العنصر الذي به خطأ.

إمضاء:

export interface FirebaseArrayIndexError 

ملكيات

ملكية يكتب وصف
خطأ خطأ فيريباسي كائن الخطأ.
فِهرِس رقم تم تمرير فهرس العنصر الذي به خطأ داخل المصفوفة الأصلية كجزء من طريقة API المسماة.

FirebaseArrayIndexError.error

كائن الخطأ.

إمضاء:

error: FirebaseError;

FirebaseArrayIndexError.index

تم تمرير فهرس العنصر الذي به خطأ داخل المصفوفة الأصلية كجزء من طريقة API المسماة.

إمضاء:

index: number;

مثال

var registrationTokens = [token1, token2, token3];
admin.messaging().subscribeToTopic(registrationTokens, 'topic-name')
  .then(function(response) {
    if (response.failureCount > 0) {
      console.log("Following devices unsucessfully subscribed to topic:");
      response.errors.forEach(function(error) {
        var invalidToken = registrationTokens[error.index];
        console.log(invalidToken, error.error);
      });
    } else {
      console.log("All devices successfully subscribed to topic:", response);
    }
  })
  .catch(function(error) {
    console.log("Error subscribing to topic:", error);
  });