ThrowCaughtExceptions
(
task
, preThrow
)
|
Method for throwing any task exceptions even hidden cancellations
Signature
static void Meta.WitAi.TaskExtensions.ThrowCaughtExceptions(this Task task, Action< string > preThrow=null) Parameters task: this TaskpreThrow: Action< string >
Optional action that calls prior to throwing an exception
Returns void |
TimeoutAfter
(
task
, ms
)
|
Causes a task to timeout after a given amount of time in ms. The task's result will be an error message
Signature
static async Task<bool> Meta.WitAi.TaskExtensions.TimeoutAfter(this Task task, int ms) Parameters task: this Task
The task to wait for
ms: int
The amount of time to wait
Returns async Task< bool >
Returns true if this task ran to completion without timing out
Throws AggregateException |
WhenLessThan
(
tasks
, max
)
|
A task that completes when less than the specified max tasks are running
Signature
static Task Meta.WitAi.TaskExtensions.WhenLessThan(this ICollection< Task > tasks, int max) Parameters tasks: this ICollection< Task >max: intReturns Task |
WhenLessThan
(
tasks
, max
, cancellationToken
)
|
A task that completes when less than the specified max tasks are running
Signature
static Task Meta.WitAi.TaskExtensions.WhenLessThan(this ICollection< Task > tasks, int max, CancellationToken cancellationToken) Parameters tasks: this ICollection< Task >max: intcancellationToken: CancellationTokenReturns Task |
WrapErrors
(
task
)
|
Method for wrapping and logging any thrown task exceptions
Signature
static void Meta.WitAi.TaskExtensions.WrapErrors(this Task task) Parameters task: this TaskReturns void |