Hi,
We have a server application (.NET Framework 4.7) that is exposing a SFTP file server implemented using Rebex File Server v5.7 (5.0.7999), with a virtual file system provider (class derived from ReadWriteFileSystemProvider ).
The virtual filesystem is exposing over SFTP data which is being read from Amazon S3 buckets.
My question is: is there any documentation/guidance on how to handle the errors/exceptions thrown by the custom FileSystemProvider, in order to have the Rebex SFTP component return more 'appropriate' errors to the client (with more specific messages at least).
An example: if one of the S3 buckets can't be accessed at a given moment (ex.: no permission), the AWS .NET SDK will throw an AmazonS3Exception with StatusCode=Forbidden (when called in an override method from the class derived from ReadWriteFileSystemProvider) ,
however the Rebex Sftp client component will throw just a generic SftpException with Message="Failure; Internal server error." and Status=ProtocolError (ProtocolCode=4).
Is there a way to re-throw a more specific exception on the server-side in such cases, in order to have the Sftp client recognize it and return a more specific error?
Server code:
internal class CustomS3FileSystem : ReadWriteFileSystemProvider
{
// ...
protected override ... SomeMethod()
{
// call AmazonS3Client
// ...
}
// ...
}
// ...
_sftpFileServer = new FileServer();
_sftpFileServer.Bind(port, FileServerProtocol.Sftp);
// ...
_sftpFileServer.Users[someUser]
.SetFileSystem(new CustomS3FileSystem (...));
Client code:
// ...
sFtp.GetList();
// ...