tonarino / actor

A minimalist actor framework aiming for high performance and simplicity.
MIT License
39 stars 6 forks source link

Migrate away from failure to own Error type(s)? #21

Closed strohel closed 3 years ago

strohel commented 3 years ago

I suggest to eventually provide own error type(s), (and let the boilerplate be filled in by thiserror).

Advantages:

Disadvantages:

This is not necessarily Before Publish stuff: the need to be able to programmatically distinguish individual error variants may not be high. Recipient::send() family of functions already use a specific error, discussed in https://github.com/tonarino/actor/issues/20.

bschwind commented 3 years ago

Definitely agreed, most of this code was written two years ago and I feel failure has gotten itself embedded a bit too deep into our codebase. Either providing a plain Error enum, or a thiserror-derived Error sound great to me.

mcginty commented 3 years ago

On my most recent projects, I've just been using Error types that impl std::error::Error and in consumers of the crates, just using type Error = Box<dyn std::error::Error> can get you a long way without needing thiserror or anyhow. Maybe we can try to not even use thiserror and keep our dependency count as low as possible :).