xtra icon indicating copy to clipboard operation
xtra copied to clipboard

Have `Error::Disconnected` contain the actor name

Open thomaseizinger opened this issue 3 years ago • 8 comments

Makes for better error messages.

thomaseizinger avatar Jul 18 '22 13:07 thomaseizinger

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.

Restioson avatar Jul 18 '22 13:07 Restioson

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.

Restioson avatar Jul 18 '22 13:07 Restioson

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?

thomaseizinger avatar Jul 18 '22 15:07 thomaseizinger

Ah, that is true!

Restioson avatar Jul 18 '22 17:07 Restioson

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

thomaseizinger avatar Jul 26 '22 15:07 thomaseizinger

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?

thomaseizinger avatar Nov 21 '22 23:11 thomaseizinger

I agree! Can definitely postpone this.

Restioson avatar Jan 31 '23 07:01 Restioson

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

thomaseizinger avatar Feb 02 '23 01:02 thomaseizinger