Return Code Testing

Advertisement

johnhom
Joined:
Posts:
1
Location:
New York

Return Code Testing

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

Reply with quote

Advertisement

arun5588
Joined:
Posts:
3
Location:
Boston

All Error Code Details

Is there a List of all Error Codes with Description you can share with us?

That would be really helpful.

Thanks,
Arun

Reply with quote

arun5588
Joined:
Posts:
3
Location:
Boston

Re: All Error Code Details

martin wrote:

Please read documentation:
https://winscp.net/eng/docs/scripting#result

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: All Error Code Details

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:
https://winscp.net/eng/docs/faq_error_codes
_________________
Martin Prikryl

Reply with quote

arun5588
Joined:
Posts:
3
Location:
Boston

List of Error Codes & Error Message

Thanks for your reply!!! but sorry still am not clear.

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

Also you can see this: https://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?

Reply with quote

Advertisement

You can post new topics in this forum