File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1515#endregion
1616
1717using System ;
18+ using System . Diagnostics ;
1819
1920namespace Grpc . Core ;
2021
2122// TODO(jtattermusch): make the Status struct readonly
2223/// <summary>
2324/// Represents RPC result, which consists of <see cref="StatusCode"/> and an optional detail string.
2425/// </summary>
26+ [ DebuggerDisplay ( "{DebuggerToString(),nq}" ) ]
2527public struct Status
2628{
2729 /// <summary>
@@ -93,4 +95,19 @@ public override string ToString()
9395 }
9496 return $ "Status(StatusCode=\" { StatusCode } \" , Detail=\" { Detail } \" )";
9597 }
98+
99+ private string DebuggerToString ( )
100+ {
101+ var text = $ "StatusCode = { StatusCode } ";
102+ if ( ! string . IsNullOrEmpty ( Detail ) )
103+ {
104+ text += $@ ", Detail = ""{ Detail } """;
105+ }
106+ if (DebugException != null)
107+ {
108+ text += $@ ", DebugException = ""{ DebugException . GetType ( ) } : { DebugException . Message } """;
109+ }
110+
111+ return text;
112+ }
96113}
You can’t perform that action at this time.
0 commit comments