# `Decree.PersonalFields.RedactedError`
[🔗](https://github.com/sparkle-space/decree/blob/v0.1.0/lib/decree/personal_fields/redacted_error.ex#L1)

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.

# `t`

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

# `format_reduced`

```elixir
@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`

```elixir
@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`

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

Answers the stand-in for `exception`.

# `reduce`

```elixir
@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`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
