silent sftp - WeOnlyDo Discussion board

silent sftp (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Haarek Ryeng, Friday, November 05, 2004, 14:22 (7325 days ago)

I'm evaluating SFTP.

How can I make the we only do .dll silent (not show dialog messages when the server reports errors)?
I want to get the error messages, add to them and show them when I find it proper...

regards,

Haarek

Re: silent sftp

by wodSupport, Friday, November 05, 2004, 15:03 (7324 days ago) @ Haarek Ryeng

Haarek,

wodSFTP does not show message boxes - Delphi is! You should put calls that make these messageboxes arround some try...catch structure - and then handle the error by yourself. Otherwise, when Delphi handles it, it shows those message boxes.

Can you try that?

Regards,
Kreso

Re: silent sftp

by Haarek Ryeng, Friday, November 05, 2004, 16:14 (7324 days ago) @ wodSupport

Haarek,

wodSFTP does not show message boxes - Delphi is! You should put calls that make these messageboxes arround some try...catch structure - and then handle the error by yourself. Otherwise, when Delphi handles it, it shows those message boxes.

Can you try that?

Regards,
Kreso

Web GUIs... I'll try again...

try
FSFTP.PutData(Stream.DataString,path);
except
FDone := true;
end;

I have a breakpoint on the line FDone := true;
A messagebox with the error text appears when executing PutData(...).
After I click OK the code continues to the breakpoint. The wodSFTP component is used in blocking mode.
A try...except block should catch pretty much every exception...

By the way - do you have a key load/generate tool? I'd like to test Key authorisation as well before I buy the component.

- Haarek -

Re: silent sftp

by wodSupport, Friday, November 05, 2004, 16:23 (7324 days ago) @ Haarek Ryeng

Haarek,

I'm 100 positive error must be trapped somehow, we've had such issues before and they were fixed like that. Let me ask arround (or try it here) what exactly to do to catch it. I'll keep you posted.

Kreso

Re: silent sftp

by wodSupport, Friday, November 05, 2004, 16:28 (7324 days ago) @ wodSupport

Forgot about this:

Haarek,
By the way - do you have a key load/generate tool? I'd like to test Key authorisation as well before I buy the component.

Yes, there is wodKeys.DLL shipped with wodSFTP. Look in SYSTEM32 folder. I think you should go to Project->Import type libary... and then you will be able to use it. You have helpfile for it in SYSTEM32 wodKeys.chm.

Regards,
Kreso

Re: silent sftp

by Joachim, Sunday, November 07, 2004, 22:14 (7322 days ago) @ wodSupport

Haarek,

I'm 100 positive error must be trapped somehow, we've had such issues before and they were fixed like that. Let me ask arround (or try it here) what exactly to do to catch it. I'll keep you posted.

Kreso

Actually the error is trapped using try...except...end though this behaviour is only achived when not executing the application inside the Delphi IDE, because the Delphi Debugger will always notice you about exceptions that occured no matter if the handled by try...except..end or not. If you execute your application outside the Delphi IDE and have trapped the error properly by usind try...except...end you won't get any dialog popping up!

Best regards,

Joachim :-)

Re: silent sftp

by Haarek Ryeng, Monday, November 08, 2004, 10:00 (7322 days ago) @ Joachim

Haarek,

I'm 100 positive error must be trapped somehow, we've had such issues before and they were fixed like that. Let me ask arround (or try it here) what exactly to do to catch it. I'll keep you posted.

Kreso

Actually the error is trapped using try...except...end though this behaviour is only achived when not executing the application inside the Delphi IDE, because the Delphi Debugger will always notice you about exceptions that occured no matter if the handled by try...except..end or not. If you execute your application outside the Delphi IDE and have trapped the error properly by usind try...except...end you won't get any dialog popping up!

Best regards,

Joachim :-)

I've have tons of other exception handling code in my application that the Delphi debugger leaves alone. Are you sure there is not a seperate thread in your component?

FDone := false;
try
FSFTP.PutData(Stream.DataString,'./'+path);
if not FDone then
raise Exception.Create('PutStream failed ');
except on e:exception do
raise exception.Create('Putstream failed due to external exception ');
end;

I've tried running the unittest application (DUnit framework) both in the debugger and on the outside as a standalone .exe-file. The exception handling code (raise exception.Create('putstr...) is not reached before I OK the exception dialog presented.

Is it possible that COM-exceptions are handled in a special manner?

- Haarek -

Re: silent sftp

by Haarek Ryeng, Monday, November 08, 2004, 10:33 (7322 days ago) @ Haarek Ryeng

I have now overridden the Application objects OnHandleException event procedure.

It seems that the exception is caught here before it comes all the way out to the calling point.

Do you at any point in your code call the Abort() procedure, or in any other way excecute the Application.OnHandleException()?

- Haarek -


I've have tons of other exception handling code in my application that the Delphi debugger leaves alone. Are you sure there is not a seperate thread in your component?

FDone := false;
try
FSFTP.PutData(Stream.DataString,'./'+path);
if not FDone then
raise Exception.Create('PutStream failed ');
except on e:exception do
raise exception.Create('Putstream failed due to external exception ');
end;

I've tried running the unittest application (DUnit framework) both in the debugger and on the outside as a standalone .exe-file. The exception handling code (raise exception.Create('putstr...) is not reached before I OK the exception dialog presented.

Is it possible that COM-exceptions are handled in a special manner?

- Haarek -
[/quote]

Re: silent sftp

by Haarek Ryeng, Monday, November 08, 2004, 11:07 (7322 days ago) @ Haarek Ryeng

I have now overridden the Application objects OnHandleException event procedure.

It seems that the exception is caught here before it comes all the way out to the calling point.

Do you at any point in your code call the Abort() procedure, or in any other way excecute the Application.OnHandleException()?

- Haarek -

Theory: wodSFTP has a thread that throws an exception. since my calling thread is not the same thread the exception is handled by the application object. Later on the component detects the error and throws another exception of the same type that my calling thread receives.

I have some event handlers assigned (onDone and onConnected) even if I have set the blocking property.
Is there a way to run the PutData() in real blocking mode (no threads)?

This is crucial to me as my application is run as a service or as an unattended application that schedules sftp delivery tasks. Exception dialogs are not an option!


- Haarek -

Re: silent sftp

by wodSupport, Monday, November 08, 2004, 11:36 (7322 days ago) @ Haarek Ryeng

Haarek,

can you zip your code and send it to techsupport@weonlydo.com? I'd like to debug this to see about it.

Also, I'm curious - do you initialize component from one thread and use it from another?

Kreso