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
ef37548a
Commit
ef37548a
authored
May 18, 2016
by
DeepakVerma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SE.Redis better error in the exception message by including innerexception details
parent
0b47916a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
ExceptionFactory.cs
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
+29
-5
No files found.
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
View file @
ef37548a
...
@@ -74,10 +74,26 @@ internal static Exception MultiSlot(bool includeDetail, Message message)
...
@@ -74,10 +74,26 @@ internal static Exception MultiSlot(bool includeDetail, Message message)
if
(
includeDetail
)
AddDetail
(
ex
,
message
,
null
,
null
);
if
(
includeDetail
)
AddDetail
(
ex
,
message
,
null
,
null
);
return
ex
;
return
ex
;
}
}
internal
static
string
GetInnerMostExceptionMessage
(
Exception
e
)
{
if
(
e
==
null
)
{
return
""
;
}
else
{
while
(
e
.
InnerException
!=
null
)
{
e
=
e
.
InnerException
;
}
return
e
.
Message
;
}
}
internal
static
Exception
NoConnectionAvailable
(
bool
includeDetail
,
RedisCommand
command
,
Message
message
,
ServerEndPoint
server
,
ServerEndPoint
[]
serverSnapshot
)
internal
static
Exception
NoConnectionAvailable
(
bool
includeDetail
,
RedisCommand
command
,
Message
message
,
ServerEndPoint
server
,
ServerEndPoint
[]
serverSnapshot
)
{
{
string
s
=
GetLabel
(
includeDetail
,
command
,
message
);
string
commandLabel
=
GetLabel
(
includeDetail
,
command
,
message
);
if
(
server
!=
null
)
if
(
server
!=
null
)
{
{
...
@@ -85,11 +101,19 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand
...
@@ -85,11 +101,19 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand
//otherwise it would output state of all the endpoints
//otherwise it would output state of all the endpoints
serverSnapshot
=
new
ServerEndPoint
[]
{
server
};
serverSnapshot
=
new
ServerEndPoint
[]
{
server
};
}
}
string
exceptionmessage
=
"No connection is available to service this operation: "
+
s
;
var
ex
=
new
RedisConnectionException
(
ConnectionFailureType
.
UnableToResolvePhysicalConnection
,
exceptionmessage
,
GetServerSnapshotInnerExceptions
(
serverSnapshot
));
var
innerException
=
GetServerSnapshotInnerExceptions
(
serverSnapshot
);
StringBuilder
exceptionmessage
=
new
StringBuilder
(
"No connection is available to service this operation: "
);
exceptionmessage
.
Append
(
commandLabel
);
exceptionmessage
.
Append
(
"; "
);
exceptionmessage
.
Append
(
GetInnerMostExceptionMessage
(
innerException
));
var
ex
=
new
RedisConnectionException
(
ConnectionFailureType
.
UnableToResolvePhysicalConnection
,
exceptionmessage
.
ToString
(),
innerException
);
if
(
includeDetail
)
if
(
includeDetail
)
{
{
AddDetail
(
ex
,
message
,
server
,
s
);
AddDetail
(
ex
,
message
,
server
,
commandLabel
);
}
}
return
ex
;
return
ex
;
}
}
...
...
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