Method Catch
View SourceCatch<TSource, TException>(IAsyncEnumerable<TSource>, Func<TException, IAsyncEnumerable<TSource>>)
Creates a sequence that corresponds to the source sequence, concatenating it with the sequence resulting from calling an exception handler function in case of an error.
Declaration
public static IAsyncEnumerable<TSource> Catch<TSource, TException>(this IAsyncEnumerable<TSource> source, Func<TException, IAsyncEnumerable<TSource>> handler) where TException : Exception
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Func<TException, IAsyncEnumerable<TSource>> | handler | Handler to invoke when an exception of the specified type occurs. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Source sequence, concatenated with an exception handler result sequence in case of an error. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
TException | Exception type to catch. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Catch<TSource>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>)
Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error.
Declaration
public static IAsyncEnumerable<TSource> Catch<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | first | First sequence. |
IAsyncEnumerable<TSource> | second | Second sequence, concatenated to the result in case the first sequence completes exceptionally. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | The first sequence, followed by the second sequence in case an error is produced. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Catch<TSource>(params IAsyncEnumerable<TSource>[])
Creates a sequence by concatenating source sequences until a source sequence completes successfully.
Declaration
public static IAsyncEnumerable<TSource> Catch<TSource>(params IAsyncEnumerable<TSource>[] sources)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource>[] | sources | Source sequences. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence that continues to concatenate source sequences while errors occur. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Catch<TSource>(IEnumerable<IAsyncEnumerable<TSource>>)
Creates a sequence by concatenating source sequences until a source sequence completes successfully.
Declaration
public static IAsyncEnumerable<TSource> Catch<TSource>(this IEnumerable<IAsyncEnumerable<TSource>> sources)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IAsyncEnumerable<TSource>> | sources | Source sequences. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence that continues to concatenate source sequences while errors occur. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Catch<TSource>(IAsyncEnumerable<IAsyncEnumerable<TSource>>)
Creates a sequence by concatenating source sequences until a source sequence completes successfully.
Declaration
public static IAsyncEnumerable<TSource> Catch<TSource>(this IAsyncEnumerable<IAsyncEnumerable<TSource>> sources)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<IAsyncEnumerable<TSource>> | sources | Source sequences. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence that continues to concatenate source sequences while errors occur. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|