Topic "Return Code Testing"

Author Message
johnhom
[View user's profile]

Joined: 2012-10-12
Posts: 1
Location: New York
I script WinSCP and it would be nice if we could test each command and return our own code for granularity. For example:

myScript:

if (open ... == 1) then return 1 # error opening connection
if (get ... == 1) then return 2 # error getting file
if (mv ... == 1) then return 3 # error moving file
return 0 # success

The thing that calls myScript:

switch (myScript(...))
case 1: print("Could not open connection"); break;
case 2: print("Could not get file" ); break;
case 3: print("Could not mv file" ); break;
end switch
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You should better use WinSCP .NET assembly:
http://winscp.net/eng/docs/library
_________________
Martin Prikryl
arun5588
[View user's profile]

Joined: 2012-11-06
Posts: 3
Location: Boston
Is there a List of all Error Codes with Description you can share with us?

That would be really helpful.

Thanks,
Arun
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please read documentation:
http://winscp.net/eng/docs/scripting#checking_results

If that does not help, come back.
_________________
Martin Prikryl
arun5588
[View user's profile]

Joined: 2012-11-06
Posts: 3
Location: Boston
prikryl wrote:
Please read documentation:
http://winscp.net/eng/docs/scripting#checking_results

If that does not help, come back.


-----------------------------------------------------

No, That doesn't help me. Actually what i am looking is "List of All the Possible Error Codes with Description of that Error comes from WinScp"

For an Example:
Error Code: 1 ; Description: error opening connection
Error Code: 2 ; Description: error getting file
.......
......
Error Code: N ; Description: xxxxxxxxx xxxxxx


Thanks for your time!
Arun
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
The documentation on the above link clearly sais, that there are only two exit codes from WinSCP 0 for success and 1 for error.

Maybe you do not mean WinSCP exit code. See also:
http://winscp.net/eng/docs/faq_error_codes
_________________
Martin Prikryl
arun5588
[View user's profile]

Joined: 2012-11-06
Posts: 3
Location: Boston
Thanks for your reply!!! but sorry still am not clear.

Please see this post: http://winscp.net/forum/viewtopic.php?t=11403
There you can see the Error Code: 3 Error Message: Permission denied

Also you can see this: http://winscp.net/forum/viewtopic.php?t=11580
There you can see the Error Code: 206 Error Message: The filename or extension too long

From where those error codes are coming from? If that is coming from FTP Servers, can you please share the possible list of those Error Codes & Error Description ?

sometimes in xml log file i noticed the error message comes with out Error Code also, below given a example.
<failure>
<message>Network error: Connection timed out.</message>
</failure>

is that mean --> if the request didn't hit the FTP Server, there won't be any Error Codes?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Ok, these are Windows system error codes:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx
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