I have this firebase security rule:
".validate": "newData.val().length < 2"
When the new data.length is > 2, Firebase returns a error that says "PERMISSON_DENIED".
I would like to know if there is a way to get a error info like this "the new data is to long".
Thanks
Firebase security rules return the same error, no matter what part failed. You have no control over the error message. If you're troubleshooting why an operation is failing, you can use the Simulator in your Firebase dashboard. But that doesn't seem what you're looking for.
Showing a more intelligent error message to the user is a great idea though. But I'd recommend doing that by validating the data before you send it to Firebase. So perform client-side validation and only send the data to Firebase if it passes the validation.
Better yet: don't allow the user to enter more than 2 characters.