Suscribe to Error method

Hi,
Using .Net 8.1 PSDK
I want to be able to receive errors from the Protocol to I can handle them in a more custom way.
Right now i do:


try{
protocol.Open();
}catch(Exception ex){
Console.Write(ex.Message);
}

But for a end user is not exactly a friendly message. Therefore would like to manage it.

If I do:


protocol.Error += protocol_Error;

Then on the function protocol_Error I receive nothing or is never invoked

Doing protocol.Received it does work…what is the difference or how to use the Error?

Thanks

I think that Error handler on connectionprotocl fired only error related to self connection, but not the error that are receiving.

??? Don’t understand what you mean Kubig

You tried to catch errors on hanlder which is not for these purposes, protocol.Error handler provides only error about connection to the server, not errors from the server

Ermmm…
Yes, for example. I have no network connection to the server. So I do the OPEN and returns “Can’t open channel” from the try:catch but doesn’t it also be notified to the Error handler?

It was just my opinion, I will try it and let you know

:wink: Thanks!