<commit_before>defmodule Sqlite.Ecto.Error do
  defexception [:message, :sqlite]

  def message(%__MODULE__{sqlite: {type, msg}}), do: "#{type}: #{msg}"
  def message(%__MODULE__{sqlite: msg}), do: "UNKNOWN: #{inspect msg}"
  def message(%__MODULE__{message: msg}), do: msg

  def exception({type, msg}), do: %__MODULE__{sqlite: {type, to_string(msg)}}
  def exception(msg), do: %__MODULE__{sqlite: msg}

  def to_constraints(_), do: []
end<commit_msg>warn for unsupported constraints<commit_after>defmodule Sqlite.Ecto.Error do
  defexception [:message, :sqlite]

  def message(%__MODULE__{sqlite: {type, msg}}), do: "#{type}: #{msg}"
  def message(%__MODULE__{sqlite: msg}), do: "UNKNOWN: #{inspect msg}"
  def message(%__MODULE__{message: msg}), do: msg

  def exception({type, msg}), do: %__MODULE__{sqlite: {type, to_string(msg)}}
  def exception(msg), do: %__MODULE__{sqlite: msg}

  require Logger

  def to_constraints(%__MODULE__{sqlite: {:constraint, "UNIQUE constraint failed: " <> _}}) do
    Logger.warn "unique_constraint/3 is unsupported by SQLite"
    []
  end
  def to_constraints(%__MODULE__{sqlite: {:constraint, "FOREIGN KEY constraint failed"}}) do
    Logger.warn "foreign_key_constraint/3 is unsupported by SQLite"
    []
  end
  def to_constraints(_), do: []
end
{'fraction_non_alphanumeric': 0.1578538102643857, 'fraction_numerical': 0.0015552099533437014, 'mean_word_length': 5.738219895287958, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3709445', 'n_tokens_mistral': 445, 'n_tokens_neox': 436, 'n_words': 115}