MCPcopy Create free account
hub / github.com/apache/thrift / ReadAsync

Method ReadAsync

lib/netstd/Thrift/TApplicationException.cs:64–111  ·  view source on GitHub ↗
(TProtocol inputProtocol, CancellationToken cancellationToken)

Source from the content-addressed store, hash-verified

62 }
63
64 public static async ValueTask<TApplicationException> ReadAsync(TProtocol inputProtocol, CancellationToken cancellationToken)
65 {
66 string message = null;
67 var type = ExceptionType.Unknown;
68
69 await inputProtocol.ReadStructBeginAsync(cancellationToken);
70 while (true)
71 {
72 var field = await inputProtocol.ReadFieldBeginAsync(cancellationToken);
73 if (field.Type == TType.Stop)
74 {
75 break;
76 }
77
78 switch (field.ID)
79 {
80 case MessageTypeFieldId:
81 if (field.Type == TType.String)
82 {
83 message = await inputProtocol.ReadStringAsync(cancellationToken);
84 }
85 else
86 {
87 await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
88 }
89 break;
90 case ExTypeFieldId:
91 if (field.Type == TType.I32)
92 {
93 type = (ExceptionType) await inputProtocol.ReadI32Async(cancellationToken);
94 }
95 else
96 {
97 await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
98 }
99 break;
100 default:
101 await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
102 break;
103 }
104
105 await inputProtocol.ReadFieldEndAsync(cancellationToken);
106 }
107
108 await inputProtocol.ReadStructEndAsync(cancellationToken);
109
110 return new TApplicationException(type, message);
111 }
112
113 public async Task WriteAsync(TProtocol outputProtocol, CancellationToken cancellationToken)
114 {

Callers

nothing calls this directly

Calls 7

SkipAsyncMethod · 0.80
ReadStructBeginAsyncMethod · 0.45
ReadFieldBeginAsyncMethod · 0.45
ReadStringAsyncMethod · 0.45
ReadI32AsyncMethod · 0.45
ReadFieldEndAsyncMethod · 0.45
ReadStructEndAsyncMethod · 0.45

Tested by

no test coverage detected