redis-dart icon indicating copy to clipboard operation
redis-dart copied to clipboard

Lazy Stream String-type error is hard to handle

Open rajmaniar opened this issue 3 years ago • 2 comments

The LazyStream / StreamNext will return a Future.error(String): https://github.com/ra1u/redis-dart/blob/master/lib/lazystream.dart#L62

It's hard to catch at a higher level and parse out what happened and what the system should do next.

Changing this to return a typed error would be easier to understand and work with. Consider either a custom error that implements Exception or even just using StateError would be okay.

rajmaniar avatar Jul 12 '21 17:07 rajmaniar

Thank for this. I think you are on point. If you can make PR that would be great. My concern is only about backward compatibility.

ra1u avatar Jul 13 '21 07:07 ra1u

You're right, backwards compatibility is an issue here. https://xkcd.com/1172/

We have a few options off the top of my head -- each have some tradeoffs:

  • Bump the major semver
  • Post a note that we're subtly breaking the api (like the Dart team does -- lol!)
  • Create a new api in LazyStream and expose it as an optional parameter in the RedisConnection.connect

rajmaniar avatar Jul 13 '21 19:07 rajmaniar