SftpPathNotFoundException
The exception that is thrown when file or directory is not found.
using Renci.SshNet.Sftp;
using System;
using System.Runtime.CompilerServices;
namespace Renci.SshNet.Common
{
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
public class SftpPathNotFoundException : SftpException
{
private const StatusCode Code = StatusCode.NoSuchFile;
public string Path { get; }
public SftpPathNotFoundException()
: this(null, null, null)
{
}
public SftpPathNotFoundException(string message)
: this(message, null, null)
{
}
public SftpPathNotFoundException(string message, string path)
: this(message, path, null)
{
}
public SftpPathNotFoundException(string message, Exception innerException)
: this(message, null, innerException)
{
}
public SftpPathNotFoundException(string message, string path, Exception innerException)
: base(StatusCode.NoSuchFile, string.IsNullOrEmpty(message) ? GetDefaultMessage(path) : message, innerException)
{
Path = path;
}
[System.Runtime.CompilerServices.NullableContext(1)]
private static string GetDefaultMessage([System.Runtime.CompilerServices.Nullable(2)] string path)
{
string defaultMessage = SftpException.GetDefaultMessage(StatusCode.NoSuchFile);
if (path == null)
return defaultMessage;
return defaultMessage + " Path: '" + path + "'.";
}
}
}