EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CElSimpleSSHClientX exceptions

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#1028
Posted: 08/17/2006 18:21:55
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

Would it be possible to set the m_wCode member of the COleDispatchException class when an exception is thrown? I would like to check the error code without having to extract it from the error description.

e.g. m_strDescription = "SSH connection failed due to error (114)", but m_wCode = 0. I would like m_wCode to be set to 114.

Thanks.
#1029
Posted: 08/18/2006 01:21:18
by Eugene Mayevski (EldoS Corp.)

There exists OnError event which provides the error code. We can't setup any C wrapper error codes from the ActiveX control. And returning a custom error code (besides E_FAIL) causes problems in some scripting environments.


Sincerely yours
Eugene Mayevski
#1032
Posted: 08/18/2006 06:17:22
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

Yes I'm handling OnError event, but I'm also trapping the exception handler and want to avoid issuing the same error message twice. Example of my code:

try
{
// opening connection (this is synchronous!)
m_SSHActiveX.Open();
}
}
catch(COleDispatchException* e)
{
CString str;
switch (e->m_wCode)
{
case ERROR_SSH_HOST_KEY_NOT_VERIFIABLE:
case ERROR_SSH_NO_MORE_AUTH_METHODS_AVAILABLE:
// Message already issued!
break;
default:
str.Format(_T("Connection failed - %s"), e->m_strDescription);
AfxMessageBox(str);
break;
}
e->Delete();
}

This doesn't work because m_wCode is always zero. Presumably you're using AfxThrowOleDispatchException to throw the exception so could you set the error code in that call?

Thanks.
#1034
Posted: 08/18/2006 09:37:09
by Eugene Mayevski (EldoS Corp.)

The control is written in Delphi, and there's nothing common to ATL there. As I mentioned above, we can't use custom error codes, other than E_FAIL.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 4583 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!