Skip to content

JobRetryException

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The exception an IJobHandler throws to signal that it wants the job retried after a specific delay.

public sealed class JobRetryException : AgentPrismException, ISerializable

objectExceptionAgentPrismExceptionJobRetryException

ISerializable

AgentPrismException.ErrorType, Exception.GetBaseException(), Exception.ToString(), Exception.GetType(), Exception.TargetSite, Exception.Message, Exception.Data, Exception.InnerException, Exception.HelpLink, Exception.Source, Exception.HResult, Exception.StackTrace, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

An ordinary exception makes the job re-leasable immediately. A handler that wants backoff throws this instead; the background worker passes the JobRetryException.RetryAfter value into the IJobStore.ReleaseForRetryAsync call.

The attempt count is still capped by JobRecord.Attempt: this exception does not keep the job alive forever.

Creates a new retry request.

public JobRetryException()

Creates a new retry request.

public JobRetryException(string message)

message string

The error message.

Creates a new retry request.

public JobRetryException(string message, Exception innerException)

message string

The error message.

innerException Exception

The underlying error.

The stable value written for AgentPrismException.ErrorType.

public const string JobRetryErrorType = "job_retry"

string

Gets the stable error type name written to the run record.

public override string ErrorType { get; }

string

Defaults to the full name of the exception type, so today’s behaviour does not change. A derived type overrides this member when the record has to be machine readable — for example AgentPrismContentFilteredException writes content_filtered. Reports and alert rules can rely on this stable name instead of an assembly name.

The value is written to RunError.Type and carries no secret.

The time to wait before the next attempt. If null, the job may be re-leased immediately.

public TimeSpan? RetryAfter { get; init; }

TimeSpan?