mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
Use ExceptionDispatchInfo in more places (#1182)
Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
|
||||
using Renci.SshNet.Abstractions;
|
||||
@@ -78,7 +79,7 @@ namespace Renci.SshNet
|
||||
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
return _authenticationResult;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
@@ -114,7 +115,7 @@ namespace Renci.SshNet
|
||||
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
return _authenticationResult;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
|
||||
using Renci.SshNet.Abstractions;
|
||||
@@ -80,7 +81,7 @@ namespace Renci.SshNet.Sftp
|
||||
|
||||
if (_exception is not null)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
if (_isEndOfFileRead)
|
||||
@@ -102,7 +103,7 @@ namespace Renci.SshNet.Sftp
|
||||
// throw when exception occured in read-ahead, or the current instance is already disposed
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
var data = nextChunk.Data;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
@@ -483,7 +484,8 @@ namespace Renci.SshNet
|
||||
switch (signaledElement)
|
||||
{
|
||||
case 0:
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
break;
|
||||
case 1:
|
||||
// Specified waithandle was signaled
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
|
||||
using Renci.SshNet.Abstractions;
|
||||
@@ -241,7 +242,8 @@ namespace Renci.SshNet
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
break;
|
||||
case 1:
|
||||
throw new SshException("Connection was closed by the server.");
|
||||
case 2:
|
||||
@@ -286,7 +288,8 @@ namespace Renci.SshNet
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
return false; // unreached
|
||||
case 1:
|
||||
throw new SshException("Connection was closed by the server.");
|
||||
case 2:
|
||||
@@ -340,7 +343,8 @@ namespace Renci.SshNet
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
return -1; // unreached
|
||||
case 1:
|
||||
throw new SshException("Connection was closed by the server.");
|
||||
case 2:
|
||||
@@ -377,7 +381,8 @@ namespace Renci.SshNet
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
return -1; // unreached
|
||||
case 1:
|
||||
throw new SshException("Connection was closed by the server.");
|
||||
case 2:
|
||||
|
||||
Reference in New Issue
Block a user