Class OutcomeStatus
Describes a success or failure outcome, e.g. of a completed worker or port.
Note: If a Db
Implements
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public sealed class OutcomeStatus : IOutcomeStatus
Properties
Category
Gets the category, if any, which describes what generated the status.
Guaranteed to not be null.
Declaration
public string Category { get; }
Property Value
| Type | Description |
|---|---|
| String |
Exception
Gets the exception that caused the failure, or null if either no exception was thrown,
or it was thrown but was caught and not rethrown.
Declaration
public Exception Exception { get; }
Property Value
| Type | Description |
|---|---|
| Exception | The exception. |
Remarks
Exception can be null even if the worker or worker system fails - this happens when
an error condition is noticed without an exception having been thrown, e.g. when testing for and
finding a null argument, logging the error, and returning an Error or Fatal status.
InnerStatuses
Gets the inner statuses, which only consists of failure statuses, or an empty list.
Declaration
public IImmutableList<IOutcomeStatus> InnerStatuses { get; }
Property Value
| Type | Description |
|---|---|
| IImmutable |
IsCanceled
Gets a value indicating whether the status is canceled.
Declaration
public bool IsCanceled { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsCompleted
Gets a value indicating whether this instance is completed, i.e. is in a final state.
Declaration
public bool IsCompleted { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsError
Gets a value indicating whether the status is an error.
Declaration
public bool IsError { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsFailed
Gets a value indicating whether the status is in a failed completed state,
i.e. Canceled, Error, or Fatal.
Declaration
public bool IsFailed { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsFatal
Gets a value indicating whether the status has fatally faulted.
Declaration
public bool IsFatal { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsSucceeded
Gets a value indicating whether the status is succeeded.
Declaration
public bool IsSucceeded { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
Message
Gets the message, if any, which provides supplementary information.
Guaranteed to not be null.
Declaration
public string Message { get; }
Property Value
| Type | Description |
|---|---|
| String |
Name
Gets the OutcomeStatus name, which is the same as the
Outcome
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
Ordinal
Gets the (0-based) Outcome
Declaration
public int Ordinal { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
State
Gets the state.
Declaration
public OutcomeState State { get; }
Property Value
| Type | Description |
|---|---|
| Outcome |
Succeeded
Gets an immutable OutcomeStatus instance with the Succeeded status.
This can e.g. be used when returning this status from a (potentially asynchronous) method.
Note: Always use the Is* properties (Is
Declaration
public static OutcomeStatus Succeeded { get; }
Property Value
| Type | Description |
|---|---|
| Outcome |
SucceededTask
Gets a completed Task with an immutable OutcomeStatus instance with the
Succeeded status.
This is typically used when returning this status from a non-async method
that has a Task<OutcomeStatus> return type.
Note: Always use the Is* properties (Is
Declaration
public static Task<OutcomeStatus> SucceededTask { get; }
Property Value
| Type | Description |
|---|---|
| Task<Outcome |
Methods
Canceled()
Creates a Canceled status instance.
Declaration
public static OutcomeStatus Canceled()
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Canceled(String)
Creates a Canceled status instance.
Declaration
public static OutcomeStatus Canceled(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Canceled(String, Exception)
Creates a Canceled status instance.
Declaration
public static OutcomeStatus Canceled(string category, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Canceled(String, Exception, String)
Creates a Canceled status instance.
Declaration
public static OutcomeStatus Canceled(string category, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Canceled(String, String)
Creates a Canceled status instance.
Declaration
public static OutcomeStatus Canceled(string category, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Combine(OutcomeStatus)
Combines the current instance with a second OutcomeStatus instance by using the most severe
as the primary one presented directly in properties, and retaining secondary statuses
(if they are failure statuses) in InnerStatuses.
Note that InnerStatuses can have (failure) statuses even if the main OutcomeStatus.Status
is OutcomeStatus.Succeeded.
Declaration
public OutcomeStatus Combine(OutcomeStatus secondStatus)
Parameters
| Type | Name | Description |
|---|---|---|
| Outcome |
secondStatus | The second status. |
Returns
| Type | Description |
|---|---|
| Outcome |
The combined OutcomeStatus. |
Remarks
Supplementary properties Category, Exception, and Message are only allowed for states Canceled,
Error, and Fatal.
The OutcomeStatus properties are immutable, i.e. they can't themselves be modified
after construction. Note however that any Exception object in the Exception
property is a mutable reference type, and its properties can be modified.
To avoid any issues with this, never modify the Exception object in an
OutcomeStatus instance that have been returned from this Combine method.
Combine(Boolean, OutcomeStatus)
Combines the current instance with a second OutcomeStatus instance by using one status as the
primary one (usually the most severe one) presented directly in properties, and retaining
secondary statuses (if they are failure statuses) in InnerStatuses.
Note that InnerStatuses can have (failure) statuses even if the main
OutcomeStatus.Status is OutcomeStatus.Succeeded.
Declaration
public OutcomeStatus Combine(bool forceFirstStatus, OutcomeStatus secondStatus)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | forceFirstStatus |
If set to In both cases, |
| Outcome |
secondStatus | The second status. |
Returns
| Type | Description |
|---|---|
| Outcome |
The combined OutcomeStatus. |
Remarks
Supplementary properties Category, Exception, and Message are only allowed for states
Canceled, Error, and Fatal.
The OutcomeStatus properties are immutable, i.e. they can't themselves be modified
after construction. Note however that any Exception object in the Exception
property is a mutable reference type, and its properties can be modified.
To avoid any issues with this, never modify the Exception object in an
OutcomeStatus instance that have been returned from this Combine method.
Error(String)
Creates an Error status instance.
Declaration
public static OutcomeStatus Error(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Error(String, Exception)
Creates an Error status instance.
Declaration
public static OutcomeStatus Error(string category, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Error(String, Exception, String)
Creates an Error status instance.
Declaration
public static OutcomeStatus Error(string category, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Error(String, String)
Creates an Error status instance.
Declaration
public static OutcomeStatus Error(string category, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Failure(OutcomeState, String)
Creates a failure status instance.
Declaration
public static OutcomeStatus Failure(OutcomeState state, string category)
Parameters
| Type | Name | Description |
|---|---|---|
| Outcome |
state | The failure state, i.e. |
| String | category | The category. Defaults to "Unset" if |
Returns
| Type | Description |
|---|---|
| Outcome |
The failure status instance. |
Failure(OutcomeState, String, Exception)
Creates a failure status instance.
Declaration
public static OutcomeStatus Failure(OutcomeState state, string category, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Outcome |
state | The failure state, i.e. |
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
Returns
| Type | Description |
|---|---|
| Outcome |
The failure status instance. |
Failure(OutcomeState, String, Exception, String)
Creates a failure status instance.
Declaration
public static OutcomeStatus Failure(OutcomeState state, string category, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Outcome |
state | The failure state, i.e. |
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The failure status instance. |
Failure(OutcomeState, String, String)
Creates a failure status instance.
Declaration
public static OutcomeStatus Failure(OutcomeState state, string category, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Outcome |
state | The failure state, i.e. |
| String | category | The category. Defaults to "Unset" if |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The failure status instance. |
Fatal(String)
Creates a Fatal status instance.
Declaration
public static OutcomeStatus Fatal(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Fatal(String, Exception)
Creates a Fatal status instance.
Declaration
public static OutcomeStatus Fatal(string category, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Fatal(String, Exception, String)
Creates a Fatal status instance.
Declaration
public static OutcomeStatus Fatal(string category, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| Exception | exception | The exception. Can be |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
Fatal(String, String)
Creates a Fatal status instance.
Declaration
public static OutcomeStatus Fatal(string category, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | category | The category. Defaults to "Unset" if |
| String | message | The message. Defaults to an empty string if |
Returns
| Type | Description |
|---|---|
| Outcome |
The |
ThrowOnFailure()
Throws an Invalid
Declaration
public void ThrowOnFailure()
Exceptions
| Type | Condition |
|---|---|
| Invalid |
State |
ToLongString()
Returns a String that describes this instance in detail.
Declaration
public string ToLongString()
Returns
| Type | Description |
|---|---|
| String |
ToProgressStatus()
Creates a ProgressStatus instance from this OutcomeStatus instance.
Declaration
public ProgressStatus ToProgressStatus()
Returns
| Type | Description |
|---|---|
| Progress |
The |
ToProgressStatusTask()
Creates a ProgressStatus instance wrapped in a Task from this instance.
Declaration
public Task<ProgressStatus> ToProgressStatusTask()
Returns
| Type | Description |
|---|---|
| Task<Progress |
The |
ToString()
Returns a String that represents this instance.
Declaration
public sealed override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
ToTask()
Returns a task with the status instance in the Task.Result property.
Declaration
public Task<OutcomeStatus> ToTask()
Returns
| Type | Description |
|---|---|
| Task<Outcome |