fix: reworking some code smell issues
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user