Restioson/xtra

Have `Error::Disconnected` contain the actor name

thomaseizinger opened this issue · 8 comments

Makes for better error messages.

I think that all the errors should probably contain actor name and message type where possible, too. This would mean having something like

struct Error {
    actor: Option<&'static str>,
    message: Option<&'static str>,
    kind: ErrorKind,
}

enum ErrorKind {
    Interrupted,
    Disconnected,
}

actor would be nullable since a disconnected message channel wouldn't know the actor type.

Related: is it worth making Error<M> and have the error return the message if the send itself fails early with Disconnected? This could be an inconvenience, but is a standard channel API thing.

actor would be nullable since a disconnected message channel wouldn't know the actor type.

A message channel knows which actor it is targeting so I think this should still be possible?

Ah, that is true!

This will also be a breaking change so I think we should try and get it into 0.6.

I am not sure I will have time to work on this any time soon. I don' think it is a must to get into 0.6 and current master is so much better than 0.5 that I think we should release it.

What do you think?

I agree! Can definitely postpone this.

Perhaps we should at least make the struct opaque such that we can work on this feature without making a breaking change?