Decree.PersonalFields.RedactedError exception (decree v0.1.0)

Copy Markdown View Source

Stands in for an exception raised while a decrypted value was in hand.

An exception can carry the value it failed on: MatchError holds its term, a database error its detail, FunctionClauseError's stack frame the arguments. So it never reaches a log or telemetry from such a path. This one holds only the module of the original, as type.

scrub_stacktrace/1 and reduce/1 do the same for a stacktrace and for an error reason.

Summary

Functions

What decree's own log lines may show of an exception raised with stacktrace: ** (Module) and the stacktrace scrubbed by scrub_stacktrace/1, never the exception's message or fields. A Decree.PersonalFields.RedactedError keeps its own message, which names only the module it stands in for; a term that is not an exception is shown by reduce/1.

What decree's own log lines may show of a command or an event: a struct's module, and reduce/1 of any other term.

Answers the stand-in for exception.

Reduces an error reason to what decree's own logs and telemetry may show: an atom stays, an exception becomes its type, a tuple with an atom head becomes {head, :redacted}, and anything else :redacted.

Answers stacktrace with each frame's argument list reduced to its arity, and each frame's location reduced to its file and line.

Types

t()

@type t() :: %Decree.PersonalFields.RedactedError{
  __exception__: term(),
  type: module()
}

Functions

format_reduced(exception, stacktrace)

@spec format_reduced(term(), Exception.stacktrace()) :: String.t()

What decree's own log lines may show of an exception raised with stacktrace: ** (Module) and the stacktrace scrubbed by scrub_stacktrace/1, never the exception's message or fields. A Decree.PersonalFields.RedactedError keeps its own message, which names only the module it stands in for; a term that is not an exception is shown by reduce/1.

module_or_reduce(term)

@spec module_or_reduce(term()) :: atom() | {atom(), :redacted}

What decree's own log lines may show of a command or an event: a struct's module, and reduce/1 of any other term.

redact(map)

@spec redact(Exception.t()) :: t()

Answers the stand-in for exception.

reduce(reason)

@spec reduce(term()) :: atom() | {atom(), :redacted}

Reduces an error reason to what decree's own logs and telemetry may show: an atom stays, an exception becomes its type, a tuple with an atom head becomes {head, :redacted}, and anything else :redacted.

scrub_stacktrace(stacktrace)

@spec scrub_stacktrace(Exception.stacktrace()) :: Exception.stacktrace()

Answers stacktrace with each frame's argument list reduced to its arity, and each frame's location reduced to its file and line.