mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-08-23 22:36:45 +00:00
fix(map): stop MapRepo.get/2 masking all errors as :not_found
MapRepo.get/2 flattened every error from Api.Map.by_id/1 into
{:error, :not_found}. That turned infrastructure faults into a
"map does not exist" signal: a DBConnection.OwnershipError in test
surfaced as "Failed to load map state" -> "map not loaded" ->
"Timeout waiting for map ... Check Map.Manager is running", pointing
at Map.Manager (which was running fine) instead of the real cause.
Keep the :not_found translation for a genuine Ash NotFound, and
propagate + log anything else.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,8 +21,15 @@ defmodule WandererApp.MapRepo do
|
||||
{:ok, map} ->
|
||||
map |> load_relationships(relationships)
|
||||
|
||||
_ ->
|
||||
{:error, %Ash.Error.Query.NotFound{}} ->
|
||||
{:error, :not_found}
|
||||
|
||||
{:error, reason} = error ->
|
||||
# Previously every error was flattened into {:error, :not_found}, which
|
||||
# masked infrastructure faults (e.g. DBConnection ownership errors) as
|
||||
# "map does not exist" and made them very hard to diagnose.
|
||||
Logger.error("MapRepo.get failed for map #{inspect(map_id)}: #{inspect(reason)}")
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user