Try + Catch User Auth Flutter Dart #4867
-
Hey guys! I'm pretty new to pocket base and want to know how do you catch errors when dealing with user authentication in Pocket base? I want to be able to catch errors when users try input their info sign in and display a UI element corresponding to the error they made. I tried parsing the error like JSON This is what I am working with below:
When I tried get the response type of the error
All I want is the data{identity:...} and password:{code...} I couldn't find anything about this in the documentation. Any help or ideas is greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't understand what do you mean by this. This is not PocketBase specific but to catch a specific error you can use either try {
...
} on ClientException catch(e) {
// e.response["data"]
} In general for all available exception fields you can refer to Error handling or the class reference. If you are still not able to resolve your issue, please paste the exact error. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response! I just didn't know you had to specify |
Beta Was this translation helpful? Give feedback.
I don't understand what do you mean by this.
This is not PocketBase specific but to catch a specific error you can use either
is
if check inside the catch block or directly filter it before the catch:In general for all available exception fields you can refer to Error handling or the class reference.
If you are still not able to resolve your issue, please paste the exact error.