Skip to content
Tracon

TraconContentBlockedException

Namespace Tracon · Assembly Tracon.Abstractions.dll

Thrown when an IContentGuard blocks content.

public sealed class TraconContentBlockedException : TraconException, ISerializable

objectExceptionTraconExceptionTraconContentBlockedException

ISerializable

TraconException.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()

This is separate from TraconContentFilteredException and must stay separate: that one reports that the provider cut the response, this one reports that Tracon’s own policy did not let the content through. Writing both to the same stable identity would cost the operator the difference between “the model refused” and “we refused”.

Neither the message nor the fields carry the blocked content. The message can reach the client in a 422 body; putting sensitive text there would spread the problem.

Creates a new error.

public TraconContentBlockedException()

Creates a new error.

public TraconContentBlockedException(string message)

message string

The error message. MUST not carry the blocked text.

TraconContentBlockedException(string, Exception)

Section titled “ TraconContentBlockedException(string, Exception)”

Creates a new error.

public TraconContentBlockedException(string message, Exception innerException)

message string

The error message. MUST not carry the blocked text.

innerException Exception

The underlying error.

The stable value written to TraconException.ErrorType.

public const string ContentBlockedErrorType = "content_blocked"

string

Gets the direction that was inspected.

public ContentGuardDirection Direction { get; init; }

ContentGuardDirection

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 TraconContentFilteredException 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.

Gets the name of the guard that made the decision.

public string? GuardName { get; init; }

string?

Gets the matched rule name, or null when the guard reports none.

public string? RuleName { get; init; }

string?