ra1u / redis-dart

fast redis protocol parser and client
MIT License
84 stars 35 forks source link

Lazy Stream String-type error is hard to handle #35

Open rajmaniar opened 3 years ago

rajmaniar commented 3 years ago

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.

ra1u commented 3 years ago

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.

rajmaniar commented 3 years ago

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: