# `Faulty.Fingerprint`
[🔗](https://github.com/Hermanverschooten/faulty/blob/main/lib/faulty/fingerprint.ex#L1)

Generates unique fingerprints for errors to enable proper grouping and deduplication.

The fingerprint is based on the error kind, source location (when available),
and a normalized version of the error reason. This approach ensures that:

- Similar errors are grouped together
- Different error types are properly separated
- Volatile details in error messages don't prevent grouping
- Errors without source information are still differentiated by type

# `generate`

```elixir
@spec generate(String.t(), String.t(), String.t(), String.t()) :: String.t()
```

Generates a SHA256 fingerprint for an error.

## Parameters

  * `kind` - The error kind (e.g., "Elixir.ArgumentError", "error")
  * `reason` - The error reason/message
  * `source_line` - Source location as "file:line" or "-" if unknown
  * `source_function` - Source function as "Module.function/arity" or "-" if unknown

## Examples

    iex> Faulty.Fingerprint.generate("error", "Erlang error: {:port_died, :normal}", "-", "-")
    "4F3263C8ABD35E3985DEB0E6422D111D12B357D665604BCF2DE101C3EAC86951"

    iex> Faulty.Fingerprint.generate("error", "Erlang error: {:tls_alert, {:bad_record_mac, \"TLS error\"}}", "-", "-")
    "D04D58179897BD41292783B5360F2E14AF691D59C168D8D8E4F316819E09C466"

# `normalize_reason_for_fingerprint`

```elixir
@spec normalize_reason_for_fingerprint(String.t()) :: String.t()
```

Normalizes an error reason for fingerprinting purposes.

Extracts the essential error type while removing volatile details like
specific messages, timestamps, or runtime-specific information that
would prevent proper error grouping.

## Examples

    iex> Faulty.Fingerprint.normalize_reason_for_fingerprint("Erlang error: {:port_died, :normal}")
    "erlang_error:port_died"

    iex> Faulty.Fingerprint.normalize_reason_for_fingerprint("ArgumentError: invalid input here")
    "elixir_exception:ArgumentError"

---

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