SessionRemoteException class questions

Advertisement

aksarben
Joined:
Posts:
72

SessionRemoteException class questions

The “Properties” link on the documentation page (https://winscp.net/eng/docs/library_sessionremoteexception#properties) seems to be broken. It doesn’t show any properties.

Would a SessionRemoteException be thrown if a PutFileToDirectory call fails due to the remote directory not existing? How would one determine that was the cause?

If I knew the cause was “directory not found,” I’d create the directory, then retry the PutFileToDirectory call. Currently, I can't do that, because I don't know the reason for the exception.

Could you perhaps add a code example on the PutFileToDirectory page showing your recommendation on how to handle a SessionRemoteException being thrown?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,253
Location:
Prague, Czechia

Re: SessionRemoteException Class Questions

I do not understand what is broken about the documentation page.
It show the only property that the class adds on top of the standard Exception class.

The exception do not provide any more details than the error message.
The best you can do is to simply check if the directory exists before trying to upload to it.

Reply with quote

aksarben
Joined:
Posts:
72

Re: SessionRemoteException Class Questions

Not trying to be argumentative, but checking for folder existence before every transfer sounds like it cause a performance hit by adding extra work for a condition that happens fairly infrequently.

Would it be possible for the assembly to throw a special Exception class when the cause is "folder not found"? Perhaps with a name something like “NoSuchFolderException”?

This kind of error is one of the few (perhaps the only?) error that we can actually do something about (i.e., create the missing folder). I'm thinking that with a special catch block that handled only one kind of error, transfers could more efficient.

Reply with quote

Advertisement

You can post new topics in this forum