FirebaseArrayIndexError interface

Composite type which includes both a FirebaseError object and an index which can be used to get the errored item.

Signature:

exportinterfaceFirebaseArrayIndexError

Properties

PropertyTypeDescription
errorFirebaseErrorThe error object.
indexnumberThe index of the errored item within the original array passed as part of the called API method.

FirebaseArrayIndexError.error

The error object.

Signature:

error:FirebaseError;

FirebaseArrayIndexError.index

The index of the errored item within the original array passed as part of the called API method.

Signature:

index:number;

Example

varregistrationTokens=[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){varinvalidToken=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);});