ประเภทคอมโพสิตซึ่งรวมถึงวัตถุ FirebaseError
และดัชนีที่สามารถใช้เพื่อรับรายการที่ผิดพลาด
ลายเซ็น:
export interface FirebaseArrayIndexError
คุณสมบัติ
คุณสมบัติ | พิมพ์ | คำอธิบาย |
---|---|---|
ข้อผิดพลาด | ข้อผิดพลาดของ Firebase | วัตถุที่มีข้อผิดพลาด |
ดัชนี | ตัวเลข | ดัชนีของรายการที่มีข้อผิดพลาดภายในอาร์เรย์ดั้งเดิมที่ส่งผ่านเป็นส่วนหนึ่งของวิธีที่เรียกว่า 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);
});