AgentPrismContentBlockedException
AgentPrism.Abstractions.dllThrown when an IContentGuard blocks content.
public sealed class AgentPrismContentBlockedException : AgentPrismException, ISerializableInheritance
Section titled “Inheritance”object ← Exception ← AgentPrismException ← AgentPrismContentBlockedException
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”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()
Remarks
Section titled “Remarks”This is separate from AgentPrismContentFilteredException and must stay separate: that one reports that the provider cut the response, this one reports that AgentPrism’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.
Constructors
Section titled “Constructors”AgentPrismContentBlockedException()
Section titled “ AgentPrismContentBlockedException()”Creates a new error.
public AgentPrismContentBlockedException()AgentPrismContentBlockedException(string)
Section titled “ AgentPrismContentBlockedException(string)”Creates a new error.
public AgentPrismContentBlockedException(string message)Parameters
Section titled “Parameters”message string
The error message. MUST not carry the blocked text.
AgentPrismContentBlockedException(string, Exception)
Section titled “ AgentPrismContentBlockedException(string, Exception)”Creates a new error.
public AgentPrismContentBlockedException(string message, Exception innerException)Parameters
Section titled “Parameters”message string
The error message. MUST not carry the blocked text.
innerException Exception
The underlying error.
Fields
Section titled “Fields”ContentBlockedErrorType
Section titled “ ContentBlockedErrorType”The stable value written to AgentPrismException.ErrorType.
public const string ContentBlockedErrorType = "content_blocked"Field Value
Section titled “Field Value”Properties
Section titled “Properties”Direction
Section titled “ Direction”Gets the direction that was inspected.
public ContentGuardDirection Direction { get; init; }Property Value
Section titled “Property Value”ErrorType
Section titled “ ErrorType”Gets the stable error type name written to the run record.
public override string ErrorType { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”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.
GuardName
Section titled “ GuardName”Gets the name of the guard that made the decision.
public string? GuardName { get; init; }Property Value
Section titled “Property Value”RuleName
Section titled “ RuleName”Gets the matched rule name, or null when the guard reports none.
public string? RuleName { get; init; }