FirebaseArrayIndexError interface

FirebaseError オブジェクトと、エラーとなったアイテムの取得に使用できるインデックスの両方を含む複合型。

署名:

export interface FirebaseArrayIndexError 

プロパティ

プロパティ 説明
エラー FirebaseError エラー オブジェクト。
index 数値 呼び出された 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);
 
});