Class ExceptionDetailRedactor
- Namespace
- Cratis.Arc
- Assembly
- Cratis.Arc.Core.dll
Redacts exception detail (messages and stack traces) from command and query results before they are serialized to a client, so internal information is not leaked outside of the Development environment.
public static class ExceptionDetailRedactor
- Inheritance
-
ExceptionDetailRedactor
- Inherited Members
Remarks
Redaction mutates the result that is about to be written to the wire; the full detail is logged
server-side first so nothing is lost. The correlation identifier is retained and a generic marker
replaces the real messages so that HasExceptions (and therefore the HTTP status code) is unchanged.
Fields
RedactedMessage
The generic message that replaces real exception detail when redaction is enabled.
public const string RedactedMessage = "An internal error occurred while processing the request. See server logs for details."
Field Value
Methods
Redact(CommandResult, bool, ILogger)
Redacts exception detail from a CommandResult when exposing detail is disabled.
public static void Redact(CommandResult result, bool exposeExceptionDetails, ILogger logger)
Parameters
resultCommandResultThe CommandResult to redact.
exposeExceptionDetailsboolWhether exception detail may be exposed to the client.
loggerILoggerThe ILogger used to log the full detail server-side.
Redact(QueryResult, bool, ILogger)
Redacts exception detail from a QueryResult when exposing detail is disabled.
public static void Redact(QueryResult result, bool exposeExceptionDetails, ILogger logger)
Parameters
resultQueryResultThe QueryResult to redact.
exposeExceptionDetailsboolWhether exception detail may be exposed to the client.
loggerILoggerThe ILogger used to log the full detail server-side.