I have this code, but i don't know how capture a error.
const coleccionRef = database.ref('test');
coleccionRef.on('value', snapshot => {
snapshot.val();
});
Any idea?
If your client doesn't have permission to read from the reference, Firebase will invoke the (optional) second callback that you can pass in to on(). E.g.
const coleccionRef = database.ref('test');
coleccionRef.on('value', snapshot => {
snapshot.val();
}, error => {
console.error(error);
});
I recommend reading the Firebase reference documentation for finding more tidbits like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With