# DurableTaskContext.CreateAttemptCanceledException(Exception?)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L287-L292)

```csharp
protected internal DurableTaskAttemptCanceledException CreateAttemptCanceledException(Exception? innerException)
```

Creates the exception which this canceled attempt's durable operations throw.

### Parameters

- `innerException` (`Exception?`): The exception which the canceled operation threw, if any.

### Exceptions

- `System.InvalidOperationException`: The attempt hasn't been canceled.
