Author Topic: Suscribe to Error method  (Read 3480 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Suscribe to Error method
« on: August 13, 2013, 07:44:51 PM »
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:

[Code]
try{
protocol.Open();
}catch(Exception ex){
Console.Write(ex.Message);
}
[/code]

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

If I do:

[Code]
protocol.Error += protocol_Error;
[/code]

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

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Suscribe to Error method
« Reply #1 on: August 14, 2013, 07:20:17 AM »
I think that Error handler on connectionprotocl fired only error related to self connection, but not the error that are receiving.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Suscribe to Error method
« Reply #2 on: August 14, 2013, 08:52:04 AM »
??? Don't understand what you mean Kubig

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Suscribe to Error method
« Reply #3 on: August 14, 2013, 09:03:39 AM »
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

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Suscribe to Error method
« Reply #4 on: August 14, 2013, 09:11:37 AM »
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?

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Suscribe to Error method
« Reply #5 on: August 14, 2013, 10:30:02 AM »
It was just my opinion, I will try it and let you know

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Suscribe to Error method
« Reply #6 on: August 14, 2013, 02:38:58 PM »
;) Thanks!