Click or drag to resize
FailedState Class
Defines the intermediate state of a background job when its processing was interrupted by an exception and it is a developer's responsibility to decide what to do with it next.
Inheritance Hierarchy

Namespace: Hangfire.States
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version:
public class FailedState : IState

The FailedState type exposes the following members.

Public methodFailedState
Initializes a new instace of the FailedState class with the given exception.
Public propertyException
Gets the exception that occurred during the background job processing.
Public propertyFailedAt
Gets a date/time when the current state instance was created.
Public propertyIgnoreJobLoadException
Gets whether transition to this state should ignore job de-serialization exceptions.
Public propertyIsFinal
Gets if the current state is a final one.
Public propertyName
Gets the unique name of the state.
Public propertyReason
Gets the human-readable reason of a state transition.
Public methodSerializeData
Gets a serialized representation of the current state.
Public fieldStatic memberStateName
Represents the name of the Failed state. This field is read-only.

Failed state is used in Hangfire when something went wrong and an exception occurred during the background job processing. The primary reason for this state is to notify the developers that something went wrong. By default background job is moved to the Failed state only after some automatic retries, because the AutomaticRetryAttribute filter is enabled by default.

Important note Important
Failed jobs are not expiring and will stay in your current job storage forever, increasing its size until you retry or delete them manually. If you expect some exceptions, please use the following rules.

It is not supposed to use the FailedState class in a user code unless you are writing state changing filters or new background processing rules.

Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also