gql-dart / gql

Libraries supporting GraphQL in Dart
MIT License
267 stars 121 forks source link

LinkException as a sealed class #425

Closed RobertBrunhage closed 3 months ago

RobertBrunhage commented 10 months ago

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

https://github.com/gql-dart/gql/blob/03186c82bd6c57785291b8346db6a5ae9008c47d/links/gql_link/lib/src/exceptions.dart#L5-L18

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 commented 10 months ago

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.

RobertBrunhage commented 3 months ago

Got it, will close this then!