This question already has an answer here:
Let's say that I have a validation rule like "validate": "condition1 && condition2"
and I want to show the user an error message according to the first condition that is not met.
For example, if condition1
isn't met, the user would receive a custom message saying that "Condition1 is not met".
Basically, I want to map an error code (or message) to each condition and that should be sent to the user (instead of the classic "Permission denied" message from Firebase).
There's not a way to do this. What you could do instead is use Cloud Functions HTTP triggers as an API for writing data. It could check the conditions you want, then return a response that indicates what's wrong with the data the client is trying to write. I understand this is far from ideal, but it might be the best option you have right now.
You can also file a feature request with a description of what you're trying to do.