core / pragma.http / redacted /

redacted #

internal suspend fun ResponseException.redacted(sensitiveValues: SensitiveValues): ResponseException

Rebuilds ktor’s response exception, keeping its type, over a view of the response whose request URL is redacted. ktor builds the message from that URL, which is how query parameters reach logs. The view reads the original body unchanged. A subclass ktor does not define cannot be rebuilt with its own type, so it fails closed: it becomes a plain ResponseException, which callers catching that subclass by type no longer match.

internal fun Throwable.redacted(sensitiveValues: SensitiveValues): Throwable

Returns this throwable unchanged when no message in its cause or suppressed chain carries a sensitive value. Otherwise returns a copy of the chain made of RedactedExceptions.