FirebaseError
オブジェクトと、エラーが発生した項目を取得するために使用できるインデックスの両方を含む複合タイプ。
サイン:
export interface FirebaseArrayIndexError
プロパティ
財産 | タイプ | 説明 |
---|---|---|
エラー | FirebaseError | エラーオブジェクト。 |
索引 | 番号 | 呼び出された 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);
});