|
1 |
| -// ------------------------------------------------------------------------ |
| 1 | +// ------------------------------------------------------------------------ |
2 | 2 | // Copyright 2021 The Dapr Authors
|
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | // you may not use this file except in compliance with the License.
|
@@ -101,10 +101,11 @@ internal async Task OnPostActorMethodAsyncInternal(ActorMethodContext actorMetho
|
101 | 101 | await this.SaveStateAsync();
|
102 | 102 | }
|
103 | 103 |
|
104 |
| - internal Task OnInvokeFailedAsync() |
| 104 | + internal async Task OnActorMethodFailedInternalAsync(ActorMethodContext actorMethodContext, Exception e) |
105 | 105 | {
|
| 106 | + await this.OnActorMethodFailedAsync(actorMethodContext, e); |
106 | 107 | // Exception has been thrown by user code, reset the state in state manager.
|
107 |
| - return this.ResetStateAsync(); |
| 108 | + await this.ResetStateAsync(); |
108 | 109 | }
|
109 | 110 |
|
110 | 111 | internal Task ResetStateAsync()
|
@@ -190,6 +191,30 @@ protected virtual Task OnPostActorMethodAsync(ActorMethodContext actorMethodCont
|
190 | 191 | return Task.CompletedTask;
|
191 | 192 | }
|
192 | 193 |
|
| 194 | + /// <summary> |
| 195 | + /// Override this method for performing any action when invoking actor method has thrown an exception. |
| 196 | + /// This method is invoked by actor runtime when invoking actor method has thrown an exception. |
| 197 | + /// </summary> |
| 198 | + /// <param name="actorMethodContext"> |
| 199 | + /// An <see cref="ActorMethodContext"/> describing the method that was invoked by actor runtime prior to this method. |
| 200 | + /// </param> |
| 201 | + /// <param name="e">Exception thrown by either actor method or by OnPreActorMethodAsync/OnPostActorMethodAsync overriden methods.</param> |
| 202 | + /// <returns> |
| 203 | + /// Returns a <see cref="Task">Task</see> representing post-actor-method operation. |
| 204 | + /// </returns> |
| 205 | + /// /// <remarks> |
| 206 | + /// This method is invoked by actor runtime prior to: |
| 207 | + /// <list type="bullet"> |
| 208 | + /// <item><description>Invoking an actor interface method when a client request comes.</description></item> |
| 209 | + /// <item><description>Invoking a method when a reminder fires.</description></item> |
| 210 | + /// <item><description>Invoking a timer callback when timer fires.</description></item> |
| 211 | + /// </list> |
| 212 | + /// </remarks> |
| 213 | + protected virtual Task OnActorMethodFailedAsync(ActorMethodContext actorMethodContext, Exception e) |
| 214 | + { |
| 215 | + return Task.CompletedTask; |
| 216 | + } |
| 217 | + |
193 | 218 | /// <summary>
|
194 | 219 | /// Registers a reminder with the actor.
|
195 | 220 | /// </summary>
|
|
0 commit comments