Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ThrowIfConvertibleException()

void System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException ( string methodName,
Exception exception,
CancellationToken cancellationToken,
bool aborted )
inlineprivate

Definition at line 1498 of file WebSocketBase.cs.

1499 {
1500 if (System.Net.NetEventSource.Log.IsEnabled() && !string.IsNullOrEmpty(methodName))
1501 {
1502 System.Net.NetEventSource.Error(this, $"methodName: {methodName}, exception: {exception}", "ThrowIfConvertibleException");
1503 }
1504 if (exception is OperationCanceledException)
1505 {
1506 if (cancellationToken.IsCancellationRequested || !aborted)
1507 {
1508 return;
1509 }
1511 }
1512 WebSocketException ex2 = exception as WebSocketException;
1513 if (ex2 != null)
1514 {
1515 cancellationToken.ThrowIfCancellationRequested();
1517 return;
1518 }
1520 {
1521 ex2 = new WebSocketException(ex3.NativeErrorCode, ex3);
1522 }
1523 if (exception is HttpListenerException ex4)
1524 {
1525 ex2 = new WebSocketException(ex4.ErrorCode, ex4);
1526 }
1528 {
1529 ex2 = new WebSocketException(ex5.NativeErrorCode, innerException);
1530 }
1531 if (ex2 != null)
1532 {
1533 cancellationToken.ThrowIfCancellationRequested();
1535 throw ex2;
1536 }
1537 if (!(exception is AggregateException ex6))
1538 {
1539 return;
1540 }
1541 ReadOnlyCollection<Exception> innerExceptions = ex6.Flatten().InnerExceptions;
1542 if (innerExceptions.Count == 0)
1543 {
1544 return;
1545 }
1546 foreach (Exception item in innerExceptions)
1547 {
1549 }
1550 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
void ThrowIfConvertibleException(string methodName, Exception exception, CancellationToken cancellationToken, bool aborted)
void ThrowIfAborted(bool aborted, Exception innerException)

References System.cancellationToken, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Net.NetEventSource.Error(), System.exception, System.item, System.Net.NetEventSource.Log, System.Net.WebSockets.WebSocketBase.ThrowIfAborted(), and System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException().

Referenced by System.Net.WebSockets.WebSocketBase.CloseAsyncCore(), System.Net.WebSockets.WebSocketBase.CloseOutputAsyncCore(), System.Net.WebSockets.WebSocketBase.ReceiveAsyncCore(), System.Net.WebSockets.WebSocketBase.SendAsyncCore(), System.Net.WebSockets.WebSocketBase.StartOnCloseCompleted(), and System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException().