Store MARK AS failure logs

pull/1200/head
Rick Carlino 2020-05-13 15:43:59 -05:00
parent 71e7c72329
commit 10695dcc98
2 changed files with 9 additions and 4 deletions

View File

@ -74,11 +74,16 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do
:ok
else
nil ->
{:error,
"#{type}.#{id} is not currently synced, so it could not be updated"}
msg = "#{type}.#{id} is not currently synced. Please re-sync."
FarmbotCore.Logger.error(3, msg)
{:error, msg}
{:error, _changeset} ->
{:error, "Failed to update #{type}.#{id}"}
msg =
"Failed update (#{type}.#{id}): Ensure the data is properly formatted"
FarmbotCore.Logger.error(3, msg)
{:error, msg}
end
end

View File

@ -34,7 +34,7 @@ defmodule FarmbotOS.SysCalls.ResourceUpdateTest do
assert String.contains?(next_plant.name, "Updated to ")
bad_result1 = ResourceUpdate.update_resource("Plant", 0, params)
error = "Plant.0 is not currently synced, so it could not be updated"
error = "Plant.0 is not currently synced. Please re-sync."
assert {:error, error} == bad_result1
end