Skip to content
Tracon

SafeErrorText

Namespace Tracon · Assembly Tracon.Abstractions.dll

Produces text that is safe to write to a persistent field or an external response, from an exception that may carry provider, network, or third-party detail.

public static class SafeErrorText

objectSafeErrorText

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

A TraconException is ours: its message is part of the contract (TraconException.ErrorType is a stable code), and is preserved as is. Any other exception’s message is never written to a persistent field or an external response — a foreign message can carry a request detail, an internal URL, a host:port, or a partial credential that the exception’s own producer (a provider SDK, a webhook target, an OAuth endpoint) put there without Tracon’s control. The safe text carries only the exception’s type name and a correlation id.

The full exception (exception.ToString, inner chain included) still goes to ILogger at the call site, tagged with the same correlation id SafeErrorText.NewCorrelationId produced, so an operator can find it. OperationCanceledException is not this method’s concern — every call site already filters it out before reaching here.

Produces text that is safe to write to a persistent field or an external response.

public static string ForPersistence(Exception exception, string correlationId)

exception Exception

The caught exception. Never null.

correlationId string

The id also written to the log entry that carries this exception’s full detail, from SafeErrorText.NewCorrelationId.

string

Produces a new correlation id to tag a log entry and the safe text derived from it.

public static string NewCorrelationId()

string