cachapa / firedart

A dart-native implementation of the Firebase Auth and Firestore SDKs
https://pub.dev/packages/firedart
Apache License 2.0
174 stars 62 forks source link

Make GrpcError public #114

Closed Nana-Kwame-bot closed 1 year ago

Nana-Kwame-bot commented 1 year ago

Hello, I would like to be able to handle errors on my end, but I can't seem to catch GrpcErrors and it's making things difficult. This is an awesome package and it has some limitations but at least let us handle the limitations. I would like to try to handle the closed streams and failed writes by calling the required methods again if need be. Showing users a readable error is also very important but I just can't do that. Please make it and any other exceptions public.

cachapa commented 1 year ago

Where exactly are you not able to catch these errors? It seems the me they're passed on in the code: https://github.com/cachapa/firedart/blob/master/lib/firestore/firestore_gateway.dart#L247

Nana-Kwame-bot commented 1 year ago

Does this mean I can import it? What's the path because when I try to catch GrpcError, intellisense can't help me add it to the list of imports. What's the path to import? Please help me out.

when I write this if (error is GrpcError) {} I get this error

The name 'GrpcError' isn't defined, so it can't be used in an 'is' expression.
Try changing the name to the name of an existing type, or creating a type with the name 'GrpcError'

I think I have imported the gateway file though like this import 'package:firedart/firestore/firestore_gateway.dart';

cachapa commented 1 year ago

I see the problem now. GrpcError is part of the grpc package, which you'd have to import manually to be able to reference it.

I will add an export directive so that class becomes directly available from Firedart, and it should autocomplete just fine.