Skip to content

Commit fd605c4

Browse files
committed
SftpClient: use nameof for ArgumentException
1 parent ccd6802 commit fd605c4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Renci.SshNet/SftpClient.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public void DeleteDirectory(string path)
354354

355355
if (string.IsNullOrWhiteSpace(path))
356356
{
357-
throw new ArgumentException("path");
357+
throw new ArgumentException(nameof(path));
358358
}
359359

360360
if (_sftpSession is null)
@@ -383,7 +383,7 @@ public void DeleteFile(string path)
383383

384384
if (string.IsNullOrWhiteSpace(path))
385385
{
386-
throw new ArgumentException("path");
386+
throw new ArgumentException(nameof(path));
387387
}
388388

389389
if (_sftpSession is null)
@@ -414,7 +414,7 @@ public async Task DeleteFileAsync(string path, CancellationToken cancellationTok
414414

415415
if (string.IsNullOrWhiteSpace(path))
416416
{
417-
throw new ArgumentException("path");
417+
throw new ArgumentException(nameof(path));
418418
}
419419

420420
if (_sftpSession is null)
@@ -541,12 +541,12 @@ public void SymbolicLink(string path, string linkPath)
541541

542542
if (string.IsNullOrWhiteSpace(path))
543543
{
544-
throw new ArgumentException("path");
544+
throw new ArgumentException(nameof(path));
545545
}
546546

547547
if (string.IsNullOrWhiteSpace(linkPath))
548548
{
549-
throw new ArgumentException("linkPath");
549+
throw new ArgumentException(nameof(linkPath));
550550
}
551551

552552
if (_sftpSession is null)
@@ -743,7 +743,7 @@ public bool Exists(string path)
743743

744744
if (string.IsNullOrWhiteSpace(path))
745745
{
746-
throw new ArgumentException("path");
746+
throw new ArgumentException(nameof(path));
747747
}
748748

749749
if (_sftpSession is null)
@@ -874,7 +874,7 @@ public IAsyncResult BeginDownloadFile(string path, Stream output, AsyncCallback?
874874

875875
if (string.IsNullOrWhiteSpace(path))
876876
{
877-
throw new ArgumentException("path");
877+
throw new ArgumentException(nameof(path));
878878
}
879879

880880
if (output is null)
@@ -1096,7 +1096,7 @@ public IAsyncResult BeginUploadFile(Stream input, string path, bool canOverride,
10961096

10971097
if (string.IsNullOrWhiteSpace(path))
10981098
{
1099-
throw new ArgumentException("path");
1099+
throw new ArgumentException(nameof(path));
11001100
}
11011101

11021102
var flags = Flags.Write | Flags.Truncate;
@@ -2091,7 +2091,7 @@ public IEnumerable<FileInfo> SynchronizeDirectories(string sourcePath, string de
20912091

20922092
if (string.IsNullOrWhiteSpace(destinationPath))
20932093
{
2094-
throw new ArgumentException("destinationPath");
2094+
throw new ArgumentException(nameof(destinationPath));
20952095
}
20962096

20972097
return InternalSynchronizeDirectories(sourcePath, destinationPath, searchPattern, asynchResult: null);
@@ -2120,7 +2120,7 @@ public IAsyncResult BeginSynchronizeDirectories(string sourcePath, string destin
21202120

21212121
if (string.IsNullOrWhiteSpace(destinationPath))
21222122
{
2123-
throw new ArgumentException("destDir");
2123+
throw new ArgumentException(nameof(destinationPath));
21242124
}
21252125

21262126
if (searchPattern is null)
@@ -2338,7 +2338,7 @@ private void InternalDownloadFile(string path, Stream output, SftpDownloadAsyncR
23382338

23392339
if (string.IsNullOrWhiteSpace(path))
23402340
{
2341-
throw new ArgumentException("path");
2341+
throw new ArgumentException(nameof(path));
23422342
}
23432343

23442344
if (_sftpSession is null)
@@ -2404,7 +2404,7 @@ private void InternalUploadFile(Stream input, string path, Flags flags, SftpUplo
24042404

24052405
if (string.IsNullOrWhiteSpace(path))
24062406
{
2407-
throw new ArgumentException("path");
2407+
throw new ArgumentException(nameof(path));
24082408
}
24092409

24102410
if (_sftpSession is null)

0 commit comments

Comments
 (0)