Topic "capturing errors for failed file transfers"

Author Message
gardenburger
[View user's profile]

Joined: 2012-07-25
Posts: 1
Location: Kansas, USA
I see how there is an example provided to log the Success of transferred files

Code:
For Each transfer As TransferEventArgs In transferResult.Transfers
   Dts.Events.FireInformation(0, Nothing, String.Format("Upload of {0} succeeded", transfer.FileName), Nothing, 0, fireAgain)
Next


but I haven't found any examples of how to log, or capture, Failed file transfers.

I notice there is a .Failures in TransferEventArgs and I suspect that somehow we can loop through and get error messages and other info about failed transfers.

Maybe something like this?:

Code:
For Each xtransfer As TransferEventArgs In transferResult.Failures
    Dim vErrMsg As String = xtransfer.Error.Message.ToString()
    Dts.Events.FireInformation(0, Nothing, String.Format("Upload failed: {0}", vErrMsg), Nothing, 0, fireAgain)
Next


I see that intellisense lists the following interested items under .Error such as:

.Data
.HelpLink
.InnerException
.Message
.Session
.Source
.StackTrace
.TargetSite

I am not sure which of these are WinSCP specific intended for logging errors and reporting file transfer failures.

I am using this in an SSIS VB.NET Script Task
Any help or examples with capturing errors would be greatly appreciated.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please read documentation:
https://winscp.net/eng/docs/library_session#results

Also the TransferEventArgs.Error is SessionRemoteException, so deal with it as with any other exception.
https://winscp.net/eng/docs/library_sessionremoteexception

If that does not help, come back.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License