Skip to content
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

LinkException as a sealed class #425

Open
RobertBrunhage opened this issue Nov 1, 2023 · 1 comment
Open

LinkException as a sealed class #425

RobertBrunhage opened this issue Nov 1, 2023 · 1 comment

Comments

@RobertBrunhage
Copy link

If LinkException would use a sealed class then we would be enforced to handle/decide not to handle, different exceptions.

Right now I go in to the source code to see what I want to handle, such as HttpLinkParserException etc

@immutable
abstract class LinkException implements Exception {
/// The original exception causing this exception
final Object? originalException;
final StackTrace? originalStackTrace;
const LinkException(
this.originalException,
this.originalStackTrace,
);
@override
String toString() => "LinkException($originalException, $originalStackTrace)";
}

Not sure if there are technical limitations for why this is not the case or if it just hasn't been updated, wanted to make the ticket either way!

@knaeckeKami
Copy link
Collaborator

in the current architecture, LinkException cannot be sealed because various link implementations (which are in different packages, e.g. gql_http_link, gql_dio_link, gql_websocket_link) use different implementations of exceptions which might attack more information on what happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants