fix: reworking some code smell issues

This commit is contained in:
2026-06-26 16:34:07 +02:00
parent 68de265137
commit d1acfd4d71
42 changed files with 661 additions and 129 deletions

View File

@@ -108,7 +108,10 @@ defmodule BDS.Embeddings.Backends.Neural do
{:reply, error, state}
end
rescue
exception ->
# Only genuine Nx/serving runtime errors become {:error, _}. Programmer bugs
# (MatchError, FunctionClauseError, …) are not caught here so they crash the
# supervised GenServer and surface unmodified instead of being repackaged.
exception in [ArgumentError, RuntimeError] ->
{:reply, {:error, Exception.message(exception)}, state}
end

View File

@@ -347,8 +347,10 @@ defmodule BDS.Embeddings.Index do
:ok
rescue
exception ->
Logger.debug(
"swallowed embeddings index persist error for #{project_id}: #{inspect(exception)}"
# Logged at :error (not :debug) so a real persist failure — or a programmer
# bug surfacing as an exception — is visible; next reindex retries the save.
Logger.error(
"embeddings index persist failed for #{project_id}: #{inspect(exception)}"
)
:ok
@@ -392,8 +394,8 @@ defmodule BDS.Embeddings.Index do
end
rescue
exception ->
Logger.debug(
"swallowed embeddings index load_from_disk error for #{project_id}: #{inspect(exception)}"
Logger.error(
"embeddings index load_from_disk failed for #{project_id}: #{inspect(exception)}"
)
:error