-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom library-level exceptions #319
Comments
@mainawycliffe @HofmannZ I'm working on this right now, and currently looking at wrapping our graphql errors in a container similar to Here's the general idea so far: // in graphql/lib/src/exceptions/exceptions.dart
class OperationException implements Exception {
List<GraphQLError> graphqlErrors = [];
// generalize to include cache error, etc
ClientException clientException;
}
// in graphql/lib/src/core/query_result.dart
class QueryResult {
// ...
// in place of List<GraphQLError> errors;
OperationException exception;
/// Whether the response includes any graphql errors
bool get hasErrors => !(exception == null);
/// Whether the response includes any graphql errors
bool get hasGraphqlErrors => exception?.graphqlErrors?.isNotEmpty ?? false;
/// graphql errors in the exception, if any
List<GraphQLError> get graphqlErrors => exception?.graphqlErrors;
// ...
} decisions / trade-offs:
|
closed by #393 |
🎉 This issue has been resolved in version 3.0.0-beta.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 3.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
As pointed out in #177
It would also make it easier / possible for users to have different logic for different errors, i.e. ignore network related issues when using the cache.
Worth noting that without something like #201, it will be easy for a user making heavy use of the offline queue to shoot themselves in the foot by pretending mutations succeeded when they didn't and will never run again.
The text was updated successfully, but these errors were encountered: