简体   繁体   English

Flutter 的 Firestore 错误代码列表

[英]List of Firestore Error Codes for Flutter

When using Cloud Firestore in my Flutter application I want to use the error codes to return a localized error message to the user.在我的 Flutter 应用程序中使用 Cloud Firestore 时,我想使用错误代码向用户返回本地化错误消息。 However, I did not find a list of all the possible error codes that could occur.但是,我没有找到所有可能发生的错误代码的列表。 Is there a list like that or do I have to handle the errors differently?是否有这样的列表,或者我必须以不同的方式处理错误?

Please have a look at the exception codes from the firebase firestore documentation.请查看 firebase firestore 文档中的异常代码

You can see the list of possible exception codes at the gRPC or at the documentation .您可以在gRPC文档中查看可能的异常代码列表。 But, you need to change the code from uppercase to all lowercase and replace underscore with dash .但是,您需要将代码从大写更改为全部小写,并将underscore替换为dash For example: PERMISSION_DENIED -> permission-denied例如: PERMISSION_DENIED -> permission-denied

NOT_FOUND -> not-found NOT_FOUND -> not-found

And so on.等等。 Also, you need to catch FirebaseException instead of PlatformException in the new version of cloud_firestore .此外,您需要在新版本的cloud_firestore中捕获FirebaseException而不是PlatformException

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM