diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs index 6c6be6d..53d9a20 100644 --- a/src/ReC.Client/Api/RecActionApi.cs +++ b/src/ReC.Client/Api/RecActionApi.cs @@ -23,14 +23,14 @@ namespace ReC.Client.Api /// The profile identifier. /// Optional reference values to pass through to all result records. /// A token to cancel the operation. - /// if the request succeeds; otherwise, . - public async Task InvokeAsync(int profileId, InvokeReferences references, CancellationToken cancellationToken = default) + /// Thrown when the API responds with a non-success status code. + public async Task InvokeAsync(int profileId, InvokeReferences references, CancellationToken cancellationToken = default) { var content = references != null ? ReCClientHelpers.ToJsonContent(references) : null; using (content) using (var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken)) { - return resp.IsSuccessStatusCode; + await ReCClientHelpers.EnsureSuccessAsync(resp, cancellationToken).ConfigureAwait(false); } } @@ -40,8 +40,8 @@ namespace ReC.Client.Api /// The profile identifier. /// Batch identifier. /// A token to cancel the operation. - /// if the request succeeds; otherwise, . - public Task InvokeAsync(int profileId, string batchId, CancellationToken cancellationToken = default) + /// Thrown when the API responds with a non-success status code. + public Task InvokeAsync(int profileId, string batchId, CancellationToken cancellationToken = default) { return InvokeAsync(profileId, new InvokeReferences() { BatchId = batchId }, cancellationToken); }