adds catch for cancelled exception to return -2
This commit is contained in:
parent
ee2e9e3b77
commit
7ac30086c9
@ -8,5 +8,15 @@ public abstract class CancellableAsyncCommand<TSettings> : AsyncCommand<TSetting
|
|||||||
|
|
||||||
protected abstract Task<int> ExecuteAsync(CommandContext context, TSettings settings, CancellationToken cancellation);
|
protected abstract Task<int> ExecuteAsync(CommandContext context, TSettings settings, CancellationToken cancellation);
|
||||||
|
|
||||||
public sealed override async Task<int> ExecuteAsync(CommandContext context, TSettings settings) => await ExecuteAsync(context, settings, _cancellationTokenSource.Token);
|
public sealed override async Task<int> ExecuteAsync(CommandContext context, TSettings settings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await ExecuteAsync(context, settings, _cancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException)
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user