Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
2b16da45
Commit
2b16da45
authored
Sep 04, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #934 - try to avoid exposing AggregateException unnecessarily
parent
16c50456
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
ConnectionMultiplexer.cs
src/StackExchange.Redis/ConnectionMultiplexer.cs
+22
-2
No files found.
src/StackExchange.Redis/ConnectionMultiplexer.cs
View file @
2b16da45
...
@@ -566,7 +566,14 @@ internal bool TryResend(int hashSlot, Message message, EndPoint endpoint, bool i
...
@@ -566,7 +566,14 @@ internal bool TryResend(int hashSlot, Message message, EndPoint endpoint, bool i
public
void
Wait
(
Task
task
)
public
void
Wait
(
Task
task
)
{
{
if
(
task
==
null
)
throw
new
ArgumentNullException
(
nameof
(
task
));
if
(
task
==
null
)
throw
new
ArgumentNullException
(
nameof
(
task
));
if
(!
task
.
Wait
(
TimeoutMilliseconds
))
throw
new
TimeoutException
();
try
{
if
(!
task
.
Wait
(
TimeoutMilliseconds
))
throw
new
TimeoutException
();
}
catch
(
AggregateException
aex
)
when
(
IsSingle
(
aex
))
{
throw
aex
.
InnerExceptions
[
0
];
}
}
}
/// <summary>
/// <summary>
...
@@ -577,10 +584,23 @@ public void Wait(Task task)
...
@@ -577,10 +584,23 @@ public void Wait(Task task)
public
T
Wait
<
T
>(
Task
<
T
>
task
)
public
T
Wait
<
T
>(
Task
<
T
>
task
)
{
{
if
(
task
==
null
)
throw
new
ArgumentNullException
(
nameof
(
task
));
if
(
task
==
null
)
throw
new
ArgumentNullException
(
nameof
(
task
));
if
(!
task
.
Wait
(
TimeoutMilliseconds
))
throw
new
TimeoutException
();
try
{
if
(!
task
.
Wait
(
TimeoutMilliseconds
))
throw
new
TimeoutException
();
}
catch
(
AggregateException
aex
)
when
(
IsSingle
(
aex
))
{
throw
aex
.
InnerExceptions
[
0
];
}
return
task
.
Result
;
return
task
.
Result
;
}
}
private
static
bool
IsSingle
(
AggregateException
aex
)
{
try
{
return
aex
!=
null
&&
aex
.
InnerExceptions
.
Count
==
1
;
}
catch
{
return
false
;
}
}
/// <summary>
/// <summary>
/// Wait for the given asynchronous operations to complete (or timeout)
/// Wait for the given asynchronous operations to complete (or timeout)
/// </summary>
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment