Is there a way to set specific error messages on v

2019-08-26 09:03发布

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).

1条回答
▲ chillily
2楼-- · 2019-08-26 09:45

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.

查看更多
登录 后发表回答