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
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