@@ -114,16 +114,15 @@ public ConsumerFailingOnDelivery(IModel model) : base(model)
114
114
{
115
115
}
116
116
117
- public override async Task HandleBasicDeliver ( string consumerTag ,
117
+ public override Task HandleBasicDeliver ( string consumerTag ,
118
118
ulong deliveryTag ,
119
119
bool redelivered ,
120
120
string exchange ,
121
121
string routingKey ,
122
122
IBasicProperties properties ,
123
123
ReadOnlyMemory < byte > body )
124
124
{
125
- await Task . Delay ( 0 ) ;
126
- throw new Exception ( "oops" ) ;
125
+ return Task . FromException ( new Exception ( "oops" ) ) ;
127
126
}
128
127
}
129
128
@@ -133,10 +132,9 @@ public ConsumerFailingOnCancel(IModel model) : base(model)
133
132
{
134
133
}
135
134
136
- public override async Task HandleBasicCancel ( string consumerTag )
135
+ public override Task HandleBasicCancel ( string consumerTag )
137
136
{
138
- await Task . Delay ( 0 ) ;
139
- throw new Exception ( "oops" ) ;
137
+ return Task . FromException ( new Exception ( "oops" ) ) ;
140
138
}
141
139
}
142
140
@@ -146,10 +144,9 @@ public ConsumerFailingOnShutdown(IModel model) : base(model)
146
144
{
147
145
}
148
146
149
- public override async Task HandleModelShutdown ( object model , ShutdownEventArgs reason )
147
+ public override Task HandleModelShutdown ( object model , ShutdownEventArgs reason )
150
148
{
151
- await Task . Delay ( 0 ) ;
152
- throw new Exception ( "oops" ) ;
149
+ return Task . FromException ( new Exception ( "oops" ) ) ;
153
150
}
154
151
}
155
152
@@ -159,10 +156,9 @@ public ConsumerFailingOnConsumeOk(IModel model) : base(model)
159
156
{
160
157
}
161
158
162
- public override async Task HandleBasicConsumeOk ( string consumerTag )
159
+ public override Task HandleBasicConsumeOk ( string consumerTag )
163
160
{
164
- await Task . Delay ( 0 ) ;
165
- throw new Exception ( "oops" ) ;
161
+ return Task . FromException ( new Exception ( "oops" ) ) ;
166
162
}
167
163
}
168
164
@@ -172,10 +168,9 @@ public ConsumerFailingOnCancelOk(IModel model) : base(model)
172
168
{
173
169
}
174
170
175
- public override async Task HandleBasicCancelOk ( string consumerTag )
171
+ public override Task HandleBasicCancelOk ( string consumerTag )
176
172
{
177
- await Task . Delay ( 0 ) ;
178
- throw new Exception ( "oops" ) ;
173
+ return Task . FromException ( new Exception ( "oops" ) ) ;
179
174
}
180
175
}
181
176
}
0 commit comments